Add asserts to test_delta_with_dbref_*, instead of relying on exceptions

This commit is contained in:
Paul Uithol 2013-07-25 14:51:09 +02:00
parent dae9e662a5
commit 2ad5ffbda2

View File

@ -691,15 +691,25 @@ class DeltaTest(unittest.TestCase):
def test_delta_with_dbref_true(self): def test_delta_with_dbref_true(self):
person, organization, employee = self.circular_reference_deltas_2(Document, Document, True) person, organization, employee = self.circular_reference_deltas_2(Document, Document, True)
employee.name = 'test' employee.name = 'test'
changed = organization._get_changed_fields()
delta = organization._delta() self.assertEqual(organization._get_changed_fields(), ['employees.0.name'])
updates, removals = organization._delta()
self.assertEqual({}, removals)
self.assertIn('employees.0', updates)
organization.save() organization.save()
def test_delta_with_dbref_false(self): def test_delta_with_dbref_false(self):
person, organization, employee = self.circular_reference_deltas_2(Document, Document, False) person, organization, employee = self.circular_reference_deltas_2(Document, Document, False)
employee.name = 'test' employee.name = 'test'
changed = organization._get_changed_fields()
delta = organization._delta() self.assertEqual(organization._get_changed_fields(), ['employees.0.name'])
updates, removals = organization._delta()
self.assertEqual({}, removals)
self.assertIn('employees.0', updates)
organization.save() organization.save()
if __name__ == '__main__': if __name__ == '__main__':