Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Djangoでテストデータを作成するときはsetUpTestDataを使う ref: http://qiita.com/tarunama/items/1dfb22650576f878f649
from test.common_data import UserFactory
class Test(TestCase):
@classmethod
def setUpTestData(cls):
cls.user = UserFactory.create()
def test_1(self):
print(self.user.pk) # 1
def test_2(self):
print(self.user.pk) # 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.