mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 04:25:42 +00:00
Cleanup / consolidate unit testing code (#4831)
- Move testing code out of helpers.py - Create new file unit_test.py
This commit is contained in:
@ -11,7 +11,7 @@ from build.models import Build, BuildItem
|
||||
from stock.models import StockItem
|
||||
|
||||
from InvenTree.status_codes import BuildStatus, StockStatus
|
||||
from InvenTree.api_tester import InvenTreeAPITestCase
|
||||
from InvenTree.unit_test import InvenTreeAPITestCase
|
||||
|
||||
|
||||
class TestBuildAPI(InvenTreeAPITestCase):
|
||||
|
@ -2,14 +2,14 @@
|
||||
|
||||
from django_test_migrations.contrib.unittest_case import MigratorTestCase
|
||||
|
||||
from InvenTree import helpers
|
||||
from InvenTree import unit_test
|
||||
|
||||
|
||||
class TestForwardMigrations(MigratorTestCase):
|
||||
"""Test entire schema migration sequence for the build app."""
|
||||
|
||||
migrate_from = ('build', helpers.getOldestMigrationFile('build'))
|
||||
migrate_to = ('build', helpers.getNewestMigrationFile('build'))
|
||||
migrate_from = ('build', unit_test.getOldestMigrationFile('build'))
|
||||
migrate_to = ('build', unit_test.getNewestMigrationFile('build'))
|
||||
|
||||
def prepare(self):
|
||||
"""Create initial data!"""
|
||||
@ -58,7 +58,7 @@ class TestForwardMigrations(MigratorTestCase):
|
||||
class TestReferenceMigration(MigratorTestCase):
|
||||
"""Test custom migration which adds 'reference' field to Build model."""
|
||||
|
||||
migrate_from = ('build', helpers.getOldestMigrationFile('build'))
|
||||
migrate_from = ('build', unit_test.getOldestMigrationFile('build'))
|
||||
migrate_to = ('build', '0018_build_reference')
|
||||
|
||||
def prepare(self):
|
||||
@ -113,7 +113,7 @@ class TestReferencePatternMigration(MigratorTestCase):
|
||||
"""
|
||||
|
||||
migrate_from = ('build', '0019_auto_20201019_1302')
|
||||
migrate_to = ('build', helpers.getNewestMigrationFile('build'))
|
||||
migrate_to = ('build', unit_test.getNewestMigrationFile('build'))
|
||||
|
||||
def prepare(self):
|
||||
"""Create some initial data prior to migration"""
|
||||
|
@ -4,7 +4,7 @@ from django.urls import reverse
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from InvenTree.helpers import InvenTreeTestCase
|
||||
from InvenTree.unit_test import InvenTreeTestCase
|
||||
|
||||
from .models import Build
|
||||
from stock.models import StockItem
|
||||
|
Reference in New Issue
Block a user