class TestCase(unittest.TestCase): def setUp(self): be = Country(name="Belgium", iso2="be") de = Country(name="Germany", iso2="de") ee = Country(name="Estonia", iso2="ee") vv = City(name="Vana-Vigala", country=ee) v = City(name="Vigala", country=ee) self.john = Person(firstname="John", name="Lennon") self.luc = Person(firstname="Luc", name="Saffre") self.luc.save() self.luc.home = Contact(addr1="Rummajaani talu", country=ee, city=vv, zipcode="78003") self.luc.home.save() def test01(self): self.assertEquals(unicode(self.luc.home), ''' Rummajaani talu 78003 Vana-Vigala Estonia''') ## to run these tests, see ## http://docs.djangoproject.com/en/dev/topics/testing/#topics-testing ## the following wouldn't work because there's no database ## if __name__ == '__main__': ## unittest.main()
class TestCase(unittest.TestCase): def setUp(self): be=Country(name="Belgium",iso2="be") de=Country(name="Germany",iso2="de") ee=Country(name="Estonia",iso2="ee") vv=City(name="Vana-Vigala",country=ee) v=City(name="Vigala",country=ee) self.john=Person(firstname="John",name="Lennon") self.luc=Person(firstname="Luc",name="Saffre") self.luc.save() self.luc.home=Contact( addr1="Rummajaani talu", country=ee,city=vv,zipcode="78003") self.luc.home.save() def test01(self): self.assertEquals(unicode(self.luc.home), ''' Rummajaani talu 78003 Vana-Vigala Estonia''') ## to run these tests, see ## http://docs.djangoproject.com/en/dev/topics/testing/#topics-testing ## the following wouldn't work because there's no database ## if __name__ == '__main__': ## unittest.main()
def setUp(self): be = Country(name="Belgium", iso2="be") de = Country(name="Germany", iso2="de") ee = Country(name="Estonia", iso2="ee") vv = City(name="Vana-Vigala", country=ee) v = City(name="Vigala", country=ee) self.john = Person(firstname="John", name="Lennon") self.luc = Person(firstname="Luc", name="Saffre") self.luc.save() self.luc.home = Contact(addr1="Rummajaani talu", country=ee, city=vv, zipcode="78003") self.luc.home.save()
def setUp(self): be=Country(name="Belgium",iso2="be") de=Country(name="Germany",iso2="de") ee=Country(name="Estonia",iso2="ee") vv=City(name="Vana-Vigala",country=ee) v=City(name="Vigala",country=ee) self.john=Person(firstname="John",name="Lennon") self.luc=Person(firstname="Luc",name="Saffre") self.luc.save() self.luc.home=Contact( addr1="Rummajaani talu", country=ee,city=vv,zipcode="78003") self.luc.home.save()