|
|
@ -45,5 +45,21 @@ class ObjectiveCase(unittest.TestCase): |
|
|
|
self.assertTrue(o1.owned_by(u1)) |
|
|
|
self.assertTrue(o1.owned_by(u1)) |
|
|
|
self.assertFalse(o2.owned_by(u1)) |
|
|
|
self.assertFalse(o2.owned_by(u1)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_delete_objectives_recursively(self): |
|
|
|
|
|
|
|
g1 = Game(name='TestGame') |
|
|
|
|
|
|
|
o1 = Objective(name='o1') |
|
|
|
|
|
|
|
o1.set_hash() |
|
|
|
|
|
|
|
g1.objectives.append(o1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
db.session.add(g1) |
|
|
|
|
|
|
|
db.session.commit() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.assertNotEqual(Objective.query.filter_by(name='o1').first(), None) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
db.session.delete(g1) |
|
|
|
|
|
|
|
db.session.commit() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.assertEqual(Objective.query.filter_by(name='o1').first(), None) |
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
if __name__ == '__main__': |
|
|
|
unittest.main(verbosity=2) |
|
|
|
unittest.main(verbosity=2) |
|
|
|