Mercurial > nosedjango
view examples/project/zoo/test_race.py @ 5:22ae9aa457af
excercise more bits of the django 1.0b1 test framework
author | Victor Ng <victor@monkeybean.ca> |
---|---|
date | Thu, 28 Aug 2008 11:29:21 -0400 |
parents | |
children |
line wrap: on
line source
# We have two test classes because we want to induce a race condition # and ensure that the database is always reset between test methods from zoo.models import * class TestDBRace1(object): def setup(self): assert Zoo.objects.count() == 0 def test1(self): obj = Zoo.objects.create(name='sample1') assert Zoo.objects.count() == 1 assert Zoo.objects.all()[0].name == 'sample1' class TestDBRace2(object): def setup(self): assert Zoo.objects.count() == 0 def test1(self): obj = Zoo.objects.create(name='sample2') assert Zoo.objects.count() == 1 assert Zoo.objects.all()[0].name == 'sample2'