示例#1
0
 def test_extend_master(self):
     ExtendCommand.add_to_master(PersonSourceMockOne)
     ExtendCommand.extend_master(PersonSourceMockTwo)
     self.assertEqual(Person.objects.annotate(num_sources=Count("sources")).filter(num_sources__gt=1).count(), 1)
     mp = Person.objects.annotate(num_sources=Count("sources")).get(num_sources__gt=1)
     self.assertEqual(sorted(mp.props.keys()), sorted(['address', 'occupation', 'sex', 'single']))
示例#2
0
 def test_add_to_master(self):
     ExtendCommand.add_to_master(PersonSourceMockOne)
     self.assertEqual(Person.objects.count(), 2)
     mp = Person.objects.last()
     self.assertEqual(mp.sources.count(), 1)
     self.skipTest("Test adding a city")