def setUp(self): u1 = User(username='******', password='******') u2 = User(username='******', password='******') u1.save() u2.save() c1 = City(title='Utrecht') c2 = City(title='Amsterdam') c3 = City(title='Eindhoven') c1.save() c2.save() c3.save() a1 = Article(title="article", text='text this is the text', author=u1) a2 = Article(title="this is article", text='text this is the text', author=u1) a3 = Article(title="this is article too", text='text this is the text', author=u1) a4 = Article(title="this is article is cool", text='text this is the text', author=u1) a5 = Article(title="this is article is not cool", text='text this is the text', author=u2) a6 = Article(title="this is article is a article", text='text this is the text', author=u2) a1.save() a2.save() a3.save() a4.save() a5.save() a6.save() a1.city.add(c1, c2, c3) a2.city.add(c1, c2, c3) a3.city.add(c1) a4.city.add(c1, c2) a5.city.add(c1, c2, c3) a6.city.add(c2)
class CitySaveTest(TestCase): def setUp(self): self.c1 = City(title='utrecht') self.c2 = City(title='Amsterdam') self.c1.save() self.c2.save() def test_city_title(self): exp_c1 = 'Utrecht' exp_c2 = 'Amsterdam' self.assertEqual(self.c1.title, exp_c1) self.assertEqual(self.c2.title, exp_c2)
def setUp(self): self.c1 = City(title='utrecht') self.c2 = City(title='Amsterdam') self.c1.save() self.c2.save()