diff options
author | Simon Charette <charette.s@gmail.com> | 2018-11-23 21:24:25 -0500 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-05-15 20:22:56 +0200 |
commit | 94f63b926fd32d7a7b6e2591ef72aa8f040f25cc (patch) | |
tree | 427aa4855f08fa75d386118765fcb0035ea07052 /tests/one_to_one | |
parent | 3cf80d3fcf7446afdde16a2be515c423f720e54d (diff) | |
download | django-94f63b926fd32d7a7b6e2591ef72aa8f040f25cc.tar.gz |
Refs #31395 -- Relied on setUpTestData() test data isolation in various tests.
Diffstat (limited to 'tests/one_to_one')
-rw-r--r-- | tests/one_to_one/tests.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/one_to_one/tests.py b/tests/one_to_one/tests.py index 1c48d500ec..bb3e5aebbf 100644 --- a/tests/one_to_one/tests.py +++ b/tests/one_to_one/tests.py @@ -10,11 +10,12 @@ from .models import ( class OneToOneTests(TestCase): - def setUp(self): - self.p1 = Place.objects.create(name='Demon Dogs', address='944 W. Fullerton') - self.p2 = Place.objects.create(name='Ace Hardware', address='1013 N. Ashland') - self.r1 = Restaurant.objects.create(place=self.p1, serves_hot_dogs=True, serves_pizza=False) - self.b1 = Bar.objects.create(place=self.p1, serves_cocktails=False) + @classmethod + def setUpTestData(cls): + cls.p1 = Place.objects.create(name='Demon Dogs', address='944 W. Fullerton') + cls.p2 = Place.objects.create(name='Ace Hardware', address='1013 N. Ashland') + cls.r1 = Restaurant.objects.create(place=cls.p1, serves_hot_dogs=True, serves_pizza=False) + cls.b1 = Bar.objects.create(place=cls.p1, serves_cocktails=False) def test_getter(self): # A Restaurant can access its place. |