Skip to content

Instantly share code, notes, and snippets.

@jezeniel
Created May 24, 2017 11:52
Show Gist options
  • Save jezeniel/818520a30a7f22822b462ca1068feb62 to your computer and use it in GitHub Desktop.
Save jezeniel/818520a30a7f22822b462ca1068feb62 to your computer and use it in GitHub Desktop.
Django Mock Model Test
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