Created
May 24, 2017 11:52
-
-
Save jezeniel/818520a30a7f22822b462ca1068feb62 to your computer and use it in GitHub Desktop.
Django Mock Model Test
This file contains hidden or 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.db import connection | |
from django.test import TestCase | |
from ..behaviors import WalletIntegration | |
class TestModel(WalletIntegration): | |
class Meta: | |
app_label = 'test' | |
class WalletTestCase(TestCase): | |
def setUp(self): | |
with connection.schema_editor() as schema_editor: | |
schema_editor.create_model(TestModel) | |
def test_wallet_id(self): | |
model = TestModel.objects.create() | |
self.assertIsNone(model.wallet_id) | |
def test_wallet_property(self): | |
model = TestModel.objects.create() | |
self.assertTrue(hasattr(model, 'wallet')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment