diff options
Diffstat (limited to 'archaeological_context_records/tests.py')
-rw-r--r-- | archaeological_context_records/tests.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/archaeological_context_records/tests.py b/archaeological_context_records/tests.py index 72144b528..2900b8786 100644 --- a/archaeological_context_records/tests.py +++ b/archaeological_context_records/tests.py @@ -48,7 +48,8 @@ class ImportContextRecordTest(ImportOperationTest): old_nb = models.ContextRecord.objects.count() MCC = ImporterType.objects.get(name=u"MCC - UE") mcc_file = open(settings.ROOT_PATH + \ - '../archaeological_context_records/tests/MCC-context-records-example.csv', 'rb') + '../archaeological_context_records/tests/'\ + 'MCC-context-records-example.csv', 'rb') file_dict = {'imported_file': SimpleUploadedFile(mcc_file.name, mcc_file.read())} post_dict = {'importer_type':MCC.pk, 'skip_lines':1, @@ -61,14 +62,12 @@ class ImportContextRecordTest(ImportOperationTest): impt = form.save(self.ishtar_user) impt.initialize() - # doing manualy connections + # doing manual connections hc = models.Unit.objects.get(txt_idx='not_in_context').pk - #for tg in TargetKey.objects.all(): - # print(tg.target, tg.key) - tg = TargetKey.objects.get(target__target='unit', key='Hors contexte') - tg.value = hc - tg.is_set = True - tg.save() + self.setTargetKey('unit', 'hc', hc) + self.setTargetKey('unit', 'hors-contexte', hc) + layer = models.Unit.objects.get(txt_idx='layer').pk + self.setTargetKey('unit', 'couche', layer) impt.importation() if not test: @@ -77,6 +76,10 @@ class ImportContextRecordTest(ImportOperationTest): # new ues has now been imported current_nb = models.ContextRecord.objects.count() self.assertTrue(current_nb == (old_nb + 4)) + self.assertEqual( + models.ContextRecord.objects.filter(unit__pk=hc).count(), 3) + self.assertEqual( + models.ContextRecord.objects.filter(unit__pk=layer).count(), 1) class ContextRecordInit(OperationInitTest): |