Last active
August 29, 2015 14:05
-
-
Save steve-chavez/a33f2d43a6bb2aedd707 to your computer and use it in GitHub Desktop.
Django one time setup in test
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 django.test import TestCase | |
from django.contrib.auth.models import User | |
from payments.models import Customer | |
# To allow test setup run only one time these workaround can be used | |
class CustomerModelTest(TestCase): | |
@classmethod | |
def setUpClass(cls): | |
cls.user = User.objects.create_user(username="test@est.com", | |
email="test@test.com", | |
password="12345", | |
first_name="Test", | |
last_name="Test") | |
cls.customer = Customer.create(cls.user) | |
def test_something(self): | |
pass | |
def test_other_thing(self): | |
pass | |
##Create user is only called one time | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment