def test_fetch_one_match(self): returned = Match.fetch_one(self.session, 1) self.assertIsNotNone(returned) self.assertEqual(self.match.id, returned.id) self.assertEqual(self.match.left_company_id, returned.left_company_id) self.assertEqual(self.match.right_company_id, returned.right_company_id)
def get(self, match_id: int): session = Match.session_from_engine(self.engine) match = Match.fetch_one(session, match_id) session.close() if not match: return {}, 404 return marshal(match, self.MARSHAL_MATCH), 200
def delete(self, match_id: int): session = Match.session_from_engine(self.engine) match = Match.fetch_one(session, match_id) if not match: session.close() return {}, 404 match.delete(session) session.commit() return marshal(match, self.MARSHAL_MATCH), 200
def test_delete(self): self.match.delete(self.session) self.session.commit() self.assertIsNone(Match.fetch_one(self.session, self.match.id))
def test_fetch_one_not_found(self): returned = Match.fetch_one(self.session, 3) self.assertIsNone(returned)