diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-24 19:14:37 +0100 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-28 12:15:25 +0100 | 
| commit | 16a47f887447ecccd56fc848aee95fa56af92548 (patch) | |
| tree | f96e518b2766d2a300829d0e5f9fac491d6d065d /archaeological_operations/tests.py | |
| parent | 0eab67538b8f2af9283bf1e77438763914e355b7 (diff) | |
| download | Ishtar-16a47f887447ecccd56fc848aee95fa56af92548.tar.bz2 Ishtar-16a47f887447ecccd56fc848aee95fa56af92548.zip  | |
get_values: get containers from operation - material_types_code from finds
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  | 
