diff options
Diffstat (limited to 'archaeological_operations/tests.py')
| -rw-r--r-- | archaeological_operations/tests.py | 28 | 
1 files changed, 28 insertions, 0 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index d8c61c642..650a839aa 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -25,6 +25,7 @@ import tempfile  import locale  import zipfile +from django.apps import apps  from django.conf import settings  from django.contrib.auth.models import Group  from django.contrib.contenttypes.models import ContentType @@ -1732,6 +1733,33 @@ class OperationTest(TestCase, OperationInitTest):          doc2 = Document.objects.get(pk=doc2.pk)          self.assertEqual(c_index + 2, doc2.index) +    def test_get_containers(self): +        Find = apps.get_model("archaeological_finds", "Find") +        BaseFind = apps.get_model("archaeological_finds", "BaseFind") +        Warehouse = apps.get_model("archaeological_warehouse", "Warehouse") +        WarehouseType = apps.get_model("archaeological_warehouse", +                                       "WarehouseType") +        Container = apps.get_model("archaeological_warehouse", "Container") +        ContainerType = apps.get_model("archaeological_warehouse", +                                       "ContainerType") +        operation = self.operations[0] +        hc, __ = Unit.objects.get_or_create(txt_idx='not-in-context', order=10) +        cr = ContextRecord.objects.create( +            operation=operation, unit=hc) +        bf = BaseFind.objects.create(context_record=cr) +        f = Find.objects.create() +        f.base_finds.add(bf) +        wt = WarehouseType.objects.create(label='WT') +        w = Warehouse.objects.create(name="Warehouse", warehouse_type=wt) +        ct = ContainerType.objects.create(label='CT') +        c = Container.objects.create(reference="Test", location=w, +                                     container_type=ct) +        f.container = c +        f.save() + +        values = operation.get_containers_values([], []) +        self.assertEqual(len(values), 1) +  class LockTest(TestCase, OperationInitTest):      fixtures = FILE_FIXTURES  | 
