def tearDown(self): Tag.objects.all().delete() Place.objects.all().delete() Thing.objects.all().delete() TagFactory.reset_sequence() PlaceFactory.reset_sequence() ThingFactory.reset_sequence()
def test_get_thing_names_has_things(self): tag = TagFactory() thing = ThingFactory() thing.tags.add(tag) thing = ThingFactory() thing.tags.add(tag) thing = ThingFactory() thing.tags.add(tag) things = tag.get_thing_names() self.assertEqual(3, things.count()) things_list = list(things) self.assertEqual(['Some Thing 1', 'Some Thing 2', 'Some Thing 3'], things_list)
def test_get_place_names_has_places(self): tag = TagFactory() place = PlaceFactory() place.tags.add(tag) place = PlaceFactory() place.tags.add(tag) place = PlaceFactory() place.tags.add(tag) places = tag.get_place_names() self.assertEqual(3, places.count()) places_list = list(places) self.assertEqual(['Some Place 1', 'Some Place 2', 'Some Place 3'], places_list)
def test_get_thing_names_no_places(self): tag = TagFactory() things = tag.get_thing_names() self.assertEqual(0, things.count())
def test_get_place_names_no_places(self): tag = TagFactory() places = tag.get_place_names() self.assertEqual(0, places.count())