Skip to content

Commit

Permalink
Added tests for fields module
Browse files Browse the repository at this point in the history
  • Loading branch information
Relrin committed Nov 2, 2016
1 parent 73dd826 commit 2e4793e
Show file tree
Hide file tree
Showing 3 changed files with 837 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/db/orm/django/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
import unittest

from django.apps import apps
from django.conf import settings
from django.db import connections


if not settings.configured:
settings.configure(
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
},
)


class DjangoUnitTest(unittest.TestCase):

models = []
apps = ()

@classmethod
def setUpClass(cls):
super(DjangoUnitTest, cls).setUpClass()
if apps:
apps.populate(cls.apps)

conn = connections['default']
with conn.schema_editor() as editor:
for model in cls.models:
editor.create_model(model)

@classmethod
def tearDownClass(cls):
super(DjangoUnitTest, cls).tearDownClass()

conn = connections['default']
with conn.schema_editor() as editor:
for model in cls.models:
editor.delete_model(model)
Loading

0 comments on commit 2e4793e

Please sign in to comment.