diff options
| author | Étienne Loks <etienne.loks@proxience.com> | 2015-06-25 11:26:39 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@proxience.com> | 2015-06-25 11:26:39 +0200 | 
| commit | 050f9dcaa43f5a613005c99d92288e85fda9bb95 (patch) | |
| tree | ae0e359f469afa8037babc036af244b1cdbd7ab3 /archaeological_context_records/tests.py | |
| parent | 9c7c7c009d4913b7af1a404d1a1f56bc128ce05c (diff) | |
| parent | d5b369ec8841a6bbffc4caf44dc90743c96bb18c (diff) | |
| download | Ishtar-050f9dcaa43f5a613005c99d92288e85fda9bb95.tar.bz2 Ishtar-050f9dcaa43f5a613005c99d92288e85fda9bb95.zip | |
Merge branch 'stable'
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): | 
