view examples/project/zoo/test_race.py @ 11:9af906a73061

added a 404.html file and updated the testcases to run against Django svn rev 8693 (post 1.0b1)
author Victor Ng <victor@monkeybean.ca>
date Fri, 29 Aug 2008 00:46:22 -0400
parents 22ae9aa457af
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'