From 59494986c1ec1554b590e33ccf39d385893c441c Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 6 Mar 2017 20:19:50 +0100 Subject: Test: label update after parcel import (refs #3460) --- archaeological_operations/tests.py | 28 +++++++++++++--------- .../tests/MCC-parcelles-example.csv | 1 + 2 files changed, 18 insertions(+), 11 deletions(-) (limited to 'archaeological_operations') diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 23c32434b..63f572643 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -298,33 +298,39 @@ class ImportOperationTest(ImportTest, TestCase): impt.importation() # new parcels has now been imported current_nb = models.Parcel.objects.count() - self.assertEqual(current_nb, old_nb + 2) + self.assertEqual(current_nb, old_nb + 3) # and well imported - last_parcels = models.Parcel.objects.order_by('-pk').all()[0:2] - external_ids = sorted(['4200-59350-YY55', '4200-75101-XXXX']) - parcel_numbers = sorted(['42', '55']) - sections = sorted(['ZX', 'YY']) + last_parcels = models.Parcel.objects.order_by('-pk').all()[0:3] + external_ids = sorted(['4200-59350-YY55', '4200-75101-XXXX', + '4201-59350-YY55']) + parcel_numbers = sorted(['42', '55', '55']) + sections = sorted(['ZX', 'YY', 'YY']) self.assertEqual(external_ids, sorted([p.external_id for p in last_parcels])) self.assertEqual(parcel_numbers, sorted([p.parcel_number for p in last_parcels])) self.assertEqual(sections, sorted([p.section for p in last_parcels])) - last_ope = models.Operation.objects.order_by('-pk').all()[0] - towns_ope = last_ope.towns.all() + ope1 = models.Operation.objects.filter(code_patriarche=4200).all()[0] + towns_ope = ope1.towns.all() imported = [imp for acc, imp in impt.get_all_imported()] for p in last_parcels: self.assertTrue(p.town in towns_ope) self.assertTrue(p in imported) self.assertEqual(len(imported), len(last_parcels)) - self.assertEqual(models.Parcel.objects.get(parcel_number='55', - section='YY').external_id, - '4200-59350-YY55') + self.assertEqual( + models.Parcel.objects.get( + parcel_number='55', section='YY', + operation_id=ope1.pk).external_id, + '4200-59350-YY55') + # cached_label update + ope2 = models.Operation.objects.filter(code_patriarche=4201).all()[0] + self.assertIn('LILLE', ope2.cached_label.upper()) # delete associated parcel with the import deletion parcel_count = models.Parcel.objects.count() impt.delete() - self.assertEqual(parcel_count - 2, models.Parcel.objects.count()) + self.assertEqual(parcel_count - 3, models.Parcel.objects.count()) def testParseParcels(self): # the database needs to be initialised before importing diff --git a/archaeological_operations/tests/MCC-parcelles-example.csv b/archaeological_operations/tests/MCC-parcelles-example.csv index 4104124b5..2d80854f0 100644 --- a/archaeological_operations/tests/MCC-parcelles-example.csv +++ b/archaeological_operations/tests/MCC-parcelles-example.csv @@ -1,3 +1,4 @@ code OA,numero INSEE commune,identifiant parcelle,numero parcelle,section cadastre,annee cadastre,nom commune,nom departement,lieu dit adresse 4200,75101,XXXX,42,ZX,,Paris,Ile-de-France,1 rue de l'Église 4200,59350,YY55,55,YY,,Lille,Nord,Patis du tertre +4201,59350,YY55,55,YY,,Lille,Nord,Patis du tertre -- cgit v1.2.3 From 70bf74767fccbe6cbdf4592759b31ddd5bb7d9c3 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 7 Mar 2017 00:04:06 +0100 Subject: Sheets: better display of creation and modification date/user (refs #3486) --- .../templates/ishtar/sheet_contextrecord.html | 16 +++++++++++-- .../templates/ishtar/sheet_file.html | 21 +++++++++++++---- .../templates/ishtar/sheet_find.html | 27 ++++++++++++---------- .../templates/ishtar/sheet_operation.html | 16 +++++++++++-- 4 files changed, 59 insertions(+), 21 deletions(-) (limited to 'archaeological_operations') diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html index e44597961..1c024dcfc 100644 --- a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html +++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html @@ -15,8 +15,20 @@