I try to use fixtures in django.test.TestCase. It works correctly, but I do it for the first time. What is the best practice in this case?
from django.test import Client, TestCase
class SomeTestClass(TestCase):
fixtures = ['fixtures.json',]
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.user = User.objects.get(id=1) # from fixtures
cls.authorized_client = Client()
cls.authorized_client.force_login(cls.user)
cls.someobject = Someclass.objects.get(id=1) # from fixtures
cls.anotherobject = Anotherclass.objects.get(id=1) # from fixtures
def test(self):
...