diff options
author | Étienne Loks <etienne.loks@proxience.com> | 2015-06-25 11:25:52 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@proxience.com> | 2015-06-25 11:25:52 +0200 |
commit | d5b369ec8841a6bbffc4caf44dc90743c96bb18c (patch) | |
tree | 554f5393dd43550a803c1669ed349e89c1fc60be /archaeological_context_records/tests.py | |
parent | 0357143da9fcac710dd40d85af2910f81f871b90 (diff) | |
download | Ishtar-d5b369ec8841a6bbffc4caf44dc90743c96bb18c.tar.bz2 Ishtar-d5b369ec8841a6bbffc4caf44dc90743c96bb18c.zip |
Import: fix unit import on MCC context record
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): |