diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-02-25 19:18:20 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-02-25 19:18:20 +0100 |
commit | 33fe24b1e8bb81b8e4e2f9851d967ce86616c62b (patch) | |
tree | 3a32725af1391917f1a477f35a9caa2da5cdf8f7 | |
parent | 513aceb9241806f7350ec7fc1ac49d3b75bc953a (diff) | |
download | Ishtar-33fe24b1e8bb81b8e4e2f9851d967ce86616c62b.tar.bz2 Ishtar-33fe24b1e8bb81b8e4e2f9851d967ce86616c62b.zip |
Tests: create necessary view(s) on _pre_setup.
-rw-r--r-- | archaeological_context_records/tests.py | 3 | ||||
-rw-r--r-- | archaeological_files/tests.py | 3 | ||||
-rw-r--r-- | archaeological_finds/tests.py | 4 | ||||
-rw-r--r-- | archaeological_operations/tests.py | 5 | ||||
-rw-r--r-- | archaeological_warehouse/tests.py | 4 | ||||
-rw-r--r-- | ishtar_common/tests.py | 13 |
6 files changed, 21 insertions, 11 deletions
diff --git a/archaeological_context_records/tests.py b/archaeological_context_records/tests.py index 0018aa1f3..2e1355572 100644 --- a/archaeological_context_records/tests.py +++ b/archaeological_context_records/tests.py @@ -22,11 +22,10 @@ import json from django.conf import settings from django.core.exceptions import ValidationError, ImproperlyConfigured from django.core.urlresolvers import reverse -from django.test import TestCase from django.test.client import Client from ishtar_common.models import IshtarSiteProfile, ImporterModel -from ishtar_common.tests import create_superuser +from ishtar_common.tests import create_superuser, TestCase from archaeological_operations.tests import OperationInitTest, \ ImportTest, ImportOperationTest from archaeological_operations import models as models_ope diff --git a/archaeological_files/tests.py b/archaeological_files/tests.py index 8a4c105c6..2b0a63af8 100644 --- a/archaeological_files/tests.py +++ b/archaeological_files/tests.py @@ -25,7 +25,8 @@ import json from django.conf import settings from django.contrib.auth.models import User -from django.test import TestCase + +from ishtar_common.tests import TestCase from ishtar_common.models import PersonType, Town, IshtarSiteProfile from archaeological_files import models diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index a1dc33dd8..cec73de8a 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -23,7 +23,6 @@ from django.conf import settings from django.contrib.auth.models import User from django.core.files.uploadedfile import SimpleUploadedFile from django.core.urlresolvers import reverse -from django.test import TestCase from django.test.client import Client from ishtar_common.models import ImporterType, IshtarUser, ImporterColumn,\ FormaterType, ImportTarget @@ -35,7 +34,8 @@ from archaeological_warehouse.models import Warehouse, WarehouseType from ishtar_common import forms_common -from ishtar_common.tests import WizardTest, WizardTestFormData as FormData +from ishtar_common.tests import WizardTest, WizardTestFormData as FormData, \ + TestCase from archaeological_operations.tests import ImportTest from archaeological_context_records.tests import ImportContextRecordTest, \ ContextRecordInit diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 18548b0b1..ab485572a 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -26,7 +26,6 @@ import datetime from django.conf import settings from django.core.files.uploadedfile import SimpleUploadedFile from django.core.urlresolvers import reverse -from django.test import TestCase from django.test.client import Client from django.contrib.auth.models import Permission @@ -41,7 +40,7 @@ from archaeological_context_records.models import Unit from ishtar_common import forms_common from ishtar_common.tests import WizardTest, WizardTestFormData as FormData, \ - create_superuser, create_user + create_superuser, create_user, TestCase class ImportTest(object): @@ -770,7 +769,7 @@ class OperationTest(TestCase, OperationInitTest): def test_cache_bulk_update(self): if settings.USE_SPATIALITE_FOR_TESTS: - # using views can only be tested with postgresql + # using views - can only be tested with postgresql return operation = self.operations[0] diff --git a/archaeological_warehouse/tests.py b/archaeological_warehouse/tests.py index 7eb3017bc..10b2318b2 100644 --- a/archaeological_warehouse/tests.py +++ b/archaeological_warehouse/tests.py @@ -18,11 +18,11 @@ # See the file COPYING for details. from django.conf import settings -from django.test import TestCase from archaeological_finds.tests import FindInit -from ishtar_common.tests import WizardTest, WizardTestFormData as FormData +from ishtar_common.tests import WizardTest, WizardTestFormData as FormData, \ + TestCase from archaeological_warehouse import models, views, forms diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index 44d7f8275..9395227b2 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -30,8 +30,9 @@ from django.core.files.base import File as DjangoFile from django.core.files.uploadedfile import SimpleUploadedFile from django.core.management import call_command from django.core.urlresolvers import reverse +from django.db import connection, transaction from django.template.defaultfilters import slugify -from django.test import TestCase +from django.test import TestCase as BaseTestCase from django.test.client import Client from django.test.simple import DjangoTestSuiteRunner @@ -39,6 +40,7 @@ from ishtar_common import models from ishtar_common import forms_common from ishtar_common.utils import post_save_point +from archaeological_context_records.models import CRBulkView """ from django.conf import settings import tempfile, datetime @@ -82,6 +84,15 @@ def create_user(): return username, password, user +class TestCase(BaseTestCase): + def _pre_setup(self): + super(TestCase, self)._pre_setup() + if not settings.USE_SPATIALITE_FOR_TESTS: + c = connection.cursor() + c.execute(CRBulkView.CREATE_SQL) + transaction.commit_unless_managed() + + class CommandsTestCase(TestCase): def test_clean_ishtar(self): """ |