Created
July 4, 2016 12:15
-
-
Save tarunama/36f1a108d5066312cc05f397f5b7dd6f to your computer and use it in GitHub Desktop.
Djangoでテストデータを作成するときはsetUpTestDataを使う ref: http://qiita.com/tarunama/items/1dfb22650576f878f649
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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