Django Test Not Getting Model Object
I am just scratching the surface of testing in Django. Here is my testing code, inside tests.py: class AdvertisingTests( TestCase ): def test_get_ad( self ): '''
Django tests create empty temporaty database see docs, which will be destroyed after tests.
To prepopulate testing DB with data you can use setUp
method:
classAdvertisingTests(TestCase):defsetUp(self):
Ad.objects.create(name="myAd")
Also you can use fixtures.
You may like these posts
Post a Comment for "Django Test Not Getting Model Object"