From 27442a9ffe40d0f548b1dc99ab917a8d8b0a02a2 Mon Sep 17 00:00:00 2001 From: Zog Date: Mon, 9 Apr 2018 11:20:56 +0200 Subject: Refs #6360; Add checks on calendars during WorkbenchImport --- app/services/zip_service.rb | 47 ++++- .../shared/iev_interfaces/_messages.html.slim | 7 +- .../object_state_updater.rb | 27 ++- config/locales/import_messages.en.yml | 2 + config/locales/import_messages.fr.yml | 4 +- lib/stif/netex_file.rb | 28 ++- spec/fixtures/multiple_with_wrong_calendar.zip | Bin 0 -> 11084 bytes .../OFFRE_TRANSDEV_20170301122517/calendriers.xml | 86 +++++++++ .../OFFRE_TRANSDEV_20170301122517/commun.xml | 33 ++++ .../offre_C00108_9.xml | 202 ++++++++++++++++++++ .../offre_C00109_10.xml | 204 +++++++++++++++++++++ .../OFFRE_TRANSDEV_20170301122519/calendriers.xml | 80 ++++++++ .../OFFRE_TRANSDEV_20170301122519/commun.xml | 32 ++++ .../offre_C00108_9.xml | 172 +++++++++++++++++ .../offre_C00109_10.xml | 172 +++++++++++++++++ spec/services/zip_service_spec.rb | 58 +++++- 16 files changed, 1124 insertions(+), 30 deletions(-) create mode 100644 spec/fixtures/multiple_with_wrong_calendar.zip create mode 100644 spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122517/calendriers.xml create mode 100644 spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122517/commun.xml create mode 100644 spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122517/offre_C00108_9.xml create mode 100644 spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122517/offre_C00109_10.xml create mode 100644 spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122519/calendriers.xml create mode 100644 spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122519/commun.xml create mode 100644 spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122519/offre_C00108_9.xml create mode 100644 spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122519/offre_C00109_10.xml diff --git a/app/services/zip_service.rb b/app/services/zip_service.rb index 7166e6448..188e1b3c8 100644 --- a/app/services/zip_service.rb +++ b/app/services/zip_service.rb @@ -1,8 +1,8 @@ class ZipService - class Subdir < Struct.new(:name, :stream, :spurious, :foreign_lines) + class Subdir < Struct.new(:name, :stream, :spurious, :foreign_lines, :missing_calendar, :wrong_calendar) def ok? - foreign_lines.empty? && spurious.empty? + foreign_lines.empty? && spurious.empty? && !missing_calendar && !wrong_calendar end end @@ -38,8 +38,23 @@ class ZipService add_to_current_output entry end + def validate entry + if is_calendar_file?(entry.name) + @current_calendar_is_missing = false + if wrong_calendar_data?(entry) + @current_calendar_is_wrong = true + return false + end + end + return false if is_spurious?(entry.name) + return false if is_foreign_line?(entry.name) + true + end + def add_to_current_output entry - return if is_spurious!(entry.name) || is_foreign_line!(entry.name) + p "entry.name: #{entry.name}" + return unless validate(entry) + p "Adding" current_output.put_next_entry entry.name write_to_current_output entry.get_input_stream @@ -48,7 +63,7 @@ class ZipService def write_to_current_output input_stream # the condition below is true for directory entries return if Zip::NullInputStream == input_stream - current_output.write input_stream.read + current_output.write input_stream.read end def finish_current_output @@ -58,7 +73,9 @@ class ZipService # Second part of the solution, yield the closed stream current_output.close_buffer, current_spurious.to_a, - foreign_lines) + foreign_lines, + @current_calendar_is_missing, + @current_calendar_is_wrong) end end @@ -68,6 +85,8 @@ class ZipService @current_output = Zip::OutputStream.new(StringIO.new(''), true, nil) @current_spurious = Set.new @foreign_lines = [] + @current_calendar_is_missing = true + @current_calendar_is_wrong = false end def entry_key entry @@ -75,7 +94,7 @@ class ZipService entry.name.split('/').first end - def is_spurious! entry_name + def is_spurious? entry_name segments = entry_name.split('/', 3) return false if segments.size < 3 @@ -83,11 +102,25 @@ class ZipService return true end - def is_foreign_line! entry_name + def is_foreign_line? entry_name STIF::NetexFile::Frame.get_short_id(entry_name).tap do | line_object_id | return nil unless line_object_id return nil if line_object_id.in? allowed_lines foreign_lines << line_object_id end end + + def is_calendar_file? entry_name + entry_name =~ /calendriers.xml$/ + end + + def wrong_calendar_data? entry + content = entry.get_input_stream.read + period = STIF::NetexFile::Frame.parse_calendars content.to_s + return true unless period + return true unless period.first + return true unless period.end + return true unless period.first <= period.end + false + end end diff --git a/app/views/shared/iev_interfaces/_messages.html.slim b/app/views/shared/iev_interfaces/_messages.html.slim index 14157a88d..4e2c4d849 100644 --- a/app/views/shared/iev_interfaces/_messages.html.slim +++ b/app/views/shared/iev_interfaces/_messages.html.slim @@ -1,14 +1,15 @@ - if messages.any? ul.list-unstyled.import_message-list - messages.order(:created_at).each do | message | + - width = message.resource_attributes.present? ? 6 : 12 li .row class=bootstrap_class_for_message_criticity(message.criticity) - if message.message_attributes && message.message_attributes["line"] .col-md-1= "L. #{message.message_attributes["line"]}" - .col-md-5= export_message_content message + div class="col-md-#{width-1}"= export_message_content message - else - .col-md-6= export_message_content message + div class="col-md-#{width}"= export_message_content message .col-md-6 - - if message.resource_attributes + - if message.resource_attributes.present? pre = JSON.pretty_generate message.resource_attributes || {} diff --git a/app/workers/workbench_import_worker/object_state_updater.rb b/app/workers/workbench_import_worker/object_state_updater.rb index 67bdc0654..1edc6b9a1 100644 --- a/app/workers/workbench_import_worker/object_state_updater.rb +++ b/app/workers/workbench_import_worker/object_state_updater.rb @@ -6,9 +6,10 @@ class WorkbenchImportWorker workbench_import.update( total_steps: count ) update_spurious entry update_foreign_lines entry + update_missing_calendar entry + update_wrong_calendar entry end - private def update_foreign_lines entry @@ -19,7 +20,7 @@ class WorkbenchImportWorker message_attributes: { 'source_filename' => workbench_import.file.file.file, 'foreign_lines' => entry.foreign_lines.join(', ') - }) + }) end def update_spurious entry @@ -30,7 +31,27 @@ class WorkbenchImportWorker message_attributes: { 'source_filename' => workbench_import.file.file.file, 'spurious_dirs' => entry.spurious.join(', ') - }) + }) + end + + def update_missing_calendar entry + return unless entry.missing_calendar + workbench_import.messages.create( + criticity: :error, + message_key: 'missing_calendar_in_zip_file', + message_attributes: { + 'source_filename' => entry.name + }) + end + + def update_wrong_calendar entry + return unless entry.wrong_calendar + workbench_import.messages.create( + criticity: :error, + message_key: 'wrong_calendar_in_zip_file', + message_attributes: { + 'source_filename' => entry.name + }) end end end diff --git a/config/locales/import_messages.en.yml b/config/locales/import_messages.en.yml index bc06c46f0..184d024ff 100644 --- a/config/locales/import_messages.en.yml +++ b/config/locales/import_messages.en.yml @@ -2,6 +2,8 @@ en: import_message: corrupt_zip_file: "The zip file %{source_filename} is corrupted and cannot be read" inconsistent_zip_file: "The zip file %{source_filename} contains unexpected directories: %{spurious_dirs}, which are ignored" + missing_calendar_in_zip_file: "The folder %{source_filename} lacks a calendar file" + wrong_calendar_in_zip_file: "The calendar file %{source_filename} cannot be parsed, or contains inconsistant data" referential_creation: "Le référentiel n'a pas pu être créé car un référentiel existe déjà sur les mêmes périodes et lignes" 1_netexstif_2: "Le fichier %{source_filename} ne respecte pas la syntaxe XML ou la XSD NeTEx : erreur '%{error_value}' rencontré" 1_netexstif_5: "%{source_filename}-Ligne %{source_line_number}-Colonne %{source_column_number} : l'objet %{source_label} d'identifiant %{source_objectid} a une date de mise à jour dans le futur" diff --git a/config/locales/import_messages.fr.yml b/config/locales/import_messages.fr.yml index 1e5054648..32dbb9fc5 100644 --- a/config/locales/import_messages.fr.yml +++ b/config/locales/import_messages.fr.yml @@ -2,10 +2,12 @@ fr: import_messages: corrupt_zip_file: "Le fichier zip est corrompu, et ne peut être lu" inconsistent_zip_file: "Le fichier zip contient des repertoires non prévus : %{spurious_dirs} qui seront ignorés" + missing_calendar_in_zip_file: "Le dossier %{source_filename} ne contient pas de calendrier" + wrong_calendar_in_zip_file: "Le calendrier contenu dans %{source_filename} contient des données incorrectes ou incohérentes" referential_creation: "Le référentiel n'a pas pu être créé car un référentiel existe déjà sur les mêmes périodes et lignes" 1_netexstif_2: "Le fichier %{source_filename} ne respecte pas la syntaxe XML ou la XSD NeTEx : erreur '%{error_value}' rencontré" 1_netexstif_5: "%{source_filename}-Ligne %{source_line_number}-Colonne %{source_column_number} : l'objet %{source_label} d'identifiant %{source_objectid} a une date de mise à jour dans le futur" - 2_netexstif_1_1: "Le fichier commun.xml ne contient pas de frame nommée NETEX_COMMUN" + 2_netexstif_1_1: "Le fichier commun.xml ne contient pas de frame nommée NTEX_COMMUN" 2_netexstif_1_2: "Le fichier commun.xml contient une frame nommée %{error_value} non acceptée" 2_netexstif_2_1: "Le fichier calendriers.xml ne contient pas de frame nommée NETEX_CALENDRIER" 2_netexstif_2_2: "Le fichier calendriers.xml contient une frame nommée %{error_value} non acceptée" diff --git a/lib/stif/netex_file.rb b/lib/stif/netex_file.rb index db0801bbe..1e78ca04a 100644 --- a/lib/stif/netex_file.rb +++ b/lib/stif/netex_file.rb @@ -47,6 +47,23 @@ module STIF base_name = File.basename(file_name) STIF::NetexFile::LINE_FILE_FORMAT.match(base_name).try(:[], 'line_object_id') end + + def parse_calendars calendars + # + # 2017-03-01 + # 2017-03-31 + # + xml = Nokogiri::XML(calendars) + from_date = nil + to_date = nil + xml.xpath("//netex:ValidBetween", "netex" => NetexFile::XML_NAME_SPACE).each do |valid_between| + from_date = valid_between.xpath("netex:FromDate").try :text + to_date = valid_between.xpath("netex:ToDate").try :text + end + from_date = from_date && Date.parse(from_date) + to_date = to_date && Date.parse(to_date) + Range.new from_date, to_date + end end attr_accessor :name @@ -56,16 +73,7 @@ module STIF end def parse_calendars(calendars) - # - # 2017-03-01 - # 2017-03-31 - # - xml = Nokogiri::XML(calendars) - xml.xpath("//netex:ValidBetween", "netex" => NetexFile::XML_NAME_SPACE).each do |valid_between| - from_date = valid_between.xpath("netex:FromDate").try :text - to_date = valid_between.xpath("netex:ToDate").try :text - periods << Range.new(Date.parse(from_date), Date.parse(to_date)) - end + periods << self.class.parse_calendars(calendars) end def add_offer_file(line_object_id) diff --git a/spec/fixtures/multiple_with_wrong_calendar.zip b/spec/fixtures/multiple_with_wrong_calendar.zip new file mode 100644 index 000000000..85c0ec61d Binary files /dev/null and b/spec/fixtures/multiple_with_wrong_calendar.zip differ diff --git a/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122517/calendriers.xml b/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122517/calendriers.xml new file mode 100644 index 000000000..bfbd0aea1 --- /dev/null +++ b/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122517/calendriers.xml @@ -0,0 +1,86 @@ + + + 2017-02-14T09:13:51.0 + CITYWAY + + + + + 2017-03-01 + 2017-03-31 + + + + + Semaine + + + Monday + + + Tuesday + + + Wednesday + + + Thursday + + + Friday + + + + + Fin de semaine + + + Saturday + + + Sunday + + + + + Service spécial + + + Restriction + + + + + + + + + + + + + 2017-03-15 + + true + + + 2017-03-15 + + false + + + + + 2017-01-01 + 2017-12-31 + + + + + + diff --git a/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122517/commun.xml b/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122517/commun.xml new file mode 100644 index 000000000..266c8a598 --- /dev/null +++ b/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122517/commun.xml @@ -0,0 +1,33 @@ + + + 2017-02-14T09:13:51.0 + CITYWAY + + + + + + + Notice 1 + 1 + ServiceJourneyNotice + + + Notice 2 + 2 + ServiceJourneyNotice + + + Notice 3 + 3 + ServiceJourneyNotice + + + + + + diff --git a/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122517/offre_C00108_9.xml b/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122517/offre_C00108_9.xml new file mode 100644 index 000000000..832793036 --- /dev/null +++ b/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122517/offre_C00108_9.xml @@ -0,0 +1,202 @@ + + + 2017-02-14T09:13:51.0 + CITYWAY + + + Ligne 1 + + + + + + + + route 1 + version="any" + outbound + + + + + route 2 + version="any" + inbound + + + + + + + Par ici + + + Par là + + + + + Par ici + + + + + + true + true + + + + true + true + + + passenger + + + Par là + + + + + + true + true + + + + true + true + + + passenger + + + + + Mission 1 + 1234 + + + Mission 2 + 2345 + + + + + + + + + + + + version="any" + + + + version="any" + + + + version="any" + + + + version="any" + + + + + ITL 1 + + + + + cannotBoardAndAlightInSameZone + + + + + + + + + + Course 1 par ici + + + + version="any" + + + + version="any" + + + version="any" + + version="any" + + + + 01:01:00.000 + 0 + 01:01:00.000 + 0 + + + 01:05:00.000 + 0 + 01:05:00.000 + 0 + + + + + + + + + + diff --git a/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122517/offre_C00109_10.xml b/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122517/offre_C00109_10.xml new file mode 100644 index 000000000..9dff0d850 --- /dev/null +++ b/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122517/offre_C00109_10.xml @@ -0,0 +1,204 @@ + + + 2017-02-14T09:13:51.0 + CITYWAY + + + Ligne 1 + + + + + + + + route 1 + version="any" + outbound + + + + + route 2 + version="any" + inbound + + + + + + + Par ici aussi + + + Par là aussi + + + + + Par ici itou + + + + + + true + true + + + + true + true + + + passenger + + + Par là itou + + + + + + true + true + + + + true + true + + + passenger + + + + + Mission 1 bis + 1234 + + + Mission 2 bis + 2345 + + + + + + + + + + + + version="any" + + + + version="any" + + + + version="any" + + + + version="any" + + + + + ITL 1 + + + + + cannotBoardAndAlightInSameZone + + + + + + + + + + Course 1 par ici aussi + + + + version="any" + + + + version="any" + + version="any" + + + version="any" + + version="any" + + + + 23:58:00.000 + 0 + 23:59:00.000 + 0 + + + 00:03:00.000 + 1 + 00:04:00.000 + 1 + + + + + + + + + + diff --git a/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122519/calendriers.xml b/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122519/calendriers.xml new file mode 100644 index 000000000..712ea8be1 --- /dev/null +++ b/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122519/calendriers.xml @@ -0,0 +1,80 @@ + + + 2017-02-14T09:13:51.0 + CITYWAY + + + + 2017-04-01T00:00:00 + 2016-12-31T00:00:00 + + + + + Semaine + + + Monday + + + Tuesday + + + Wednesday + + + Thursday + + + Friday + + + + + Fin de semaine + + + Saturday + + + Sunday + + + + + Service spécial + + + Restriction + + + + + + + + + + + 2017-03-15 + + true + + + 2017-03-15 + + false + + + 2017-01-01T00:00:00 + 2017-12-31T00:00:00 + + + + + + diff --git a/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122519/commun.xml b/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122519/commun.xml new file mode 100644 index 000000000..f59f8ac2d --- /dev/null +++ b/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122519/commun.xml @@ -0,0 +1,32 @@ + + + 2017-02-14T09:13:51.0 + CITYWAY + + + + + + + Notice 1 + 1 + + + + Notice 2 + 2 + + + + Notice 3 + 3 + + + + + + + diff --git a/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122519/offre_C00108_9.xml b/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122519/offre_C00108_9.xml new file mode 100644 index 000000000..9eefeeb43 --- /dev/null +++ b/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122519/offre_C00108_9.xml @@ -0,0 +1,172 @@ + + + 2017-02-14T09:13:51.0 + CITYWAY + + + Ligne 1 + + + + + + + + route 1 + version="any" + outbound + + + + + route 2 + version="any" + inbound + + + + + + + Par ici + + + Par là + + + + + Par ici + + + + + + true + true + + + + true + true + + + passenger + + + Par là + + + + + + true + true + + + + true + true + + + passenger + + + + + Mission 1 + 1234 + + + Mission 2 + 2345 + + + + + + + + + + + + version="any" + + + + version="any" + + + + version="any" + + + + version="any" + + + + + ITL 1 + + + + + cannotBoardAndAlightInSameZone + + + + + + + + + + Course 1 par ici + + + + version="any" + + + + version="any" + + + + + version="any" + + version="any" + + + + 01:01:00.000 + 0 + 01:01:00.000 + 0 + + + 01:05:00.000 + 0 + 01:05:00.000 + 0 + + + + + + + + + + diff --git a/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122519/offre_C00109_10.xml b/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122519/offre_C00109_10.xml new file mode 100644 index 000000000..d260ef17e --- /dev/null +++ b/spec/fixtures/multiple_with_wrong_calendar/OFFRE_TRANSDEV_20170301122519/offre_C00109_10.xml @@ -0,0 +1,172 @@ + + + 2017-02-14T09:13:51.0 + CITYWAY + + + Ligne 1 + + + + + + + + route 1 + version="any" + outbound + + + + + route 2 + version="any" + inbound + + + + + + + Par ici aussi + + + Par là aussi + + + + + Par ici itou + + + + + + true + true + + + + true + true + + + passenger + + + Par là itou + + + + + + true + true + + + + true + true + + + passenger + + + + + Mission 1 bis + 1234 + + + Mission 2 bis + 2345 + + + + + + + + + + + + version="any" + + + + version="any" + + + + version="any" + + + + version="any" + + + + + ITL 1 + + + + + cannotBoardAndAlightInSameZone + + + + + + + + + + Course 1 par ici aussi + + + + version="any" + + + + version="any" + version="any" + + + + version="any" + + version="any" + + + + 23:58:00.000 + 0 + 23:59:00.000 + 0 + + + 00:03:00.000 + 1 + 00:04:00.000 + 1 + + + + + + + + + + diff --git a/spec/services/zip_service_spec.rb b/spec/services/zip_service_spec.rb index 1eadaa3bf..540de5bfc 100644 --- a/spec/services/zip_service_spec.rb +++ b/spec/services/zip_service_spec.rb @@ -42,6 +42,24 @@ RSpec.describe ZipService, type: :zip do end end + context 'one referential without calendar' do + let( :zip_name ){ 'one_referential_no_calendar.zip' } + let( :zip_content ){ first_referential_no_calendar_data } + + it 'returns a not ok object' do + expect_incorrect_subdir subject.first, expected_missing_calendar: true + end + end + + context 'one referential with an unparsable calendar' do + let( :zip_name ){ 'one_referential_unparsable_calendar.zip' } + let( :zip_content ){ first_referential_unparsable_calendar_data } + + it 'returns a not ok object' do + expect_incorrect_subdir subject.first, expected_wrong_calendar: true + end + end + context 'one referential with a foreign line' do let( :zip_name ){ 'one_referential_foreign.zip' } let( :zip_content ){ first_referential_foreign_data } @@ -109,17 +127,29 @@ RSpec.describe ZipService, type: :zip do end end - def expect_incorrect_subdir subdir, expected_spurious: [], expected_foreign_lines: [] + def expect_incorrect_subdir subdir, expected_spurious: [], expected_foreign_lines: [], expected_missing_calendar: false, expected_wrong_calendar: false expect( subdir ).not_to be_ok expect( subdir.foreign_lines ).to eq(expected_foreign_lines) expect( subdir.spurious ).to eq(expected_spurious) + expect( subdir.missing_calendar ).to eq(expected_missing_calendar) + expect( subdir.wrong_calendar ).to eq(expected_wrong_calendar) end # Data # ---- + let :valid_calendar do + """ + + + 2017-03-01 + 2017-03-31 + + + """ + end let :first_referential_ok_data do { - 'Referential1/calendriers.xml' => 'calendriers', + 'Referential1/calendriers.xml' => valid_calendar, 'Referential1/commun.xml' => 'common', 'Referential1/offre_C00108_9.xml' => 'line 108 ref 1', 'Referential1/offre_C00109_10.xml' => 'line 109 ref 1' @@ -127,7 +157,7 @@ RSpec.describe ZipService, type: :zip do end let :first_referential_foreign_data do { - 'Referential2/calendriers.xml' => 'calendriers', + 'Referential2/calendriers.xml' => valid_calendar, 'Referential2/commun.xml' => 'common', 'Referential2/offre_C00110_11.xml' => 'foreign line ref 1', 'Referential2/offre_C00108_9.xml' => 'line 108 ref 1', @@ -136,7 +166,7 @@ RSpec.describe ZipService, type: :zip do end let :first_referential_spurious_data do { - 'Referential3/calendriers.xml' => 'calendriers', + 'Referential3/calendriers.xml' => valid_calendar, 'Referential3/commun.xml' => 'common', 'Referential3/SPURIOUS/commun.xml' => 'common', 'Referential3/offre_C00108_9.xml' => 'line 108 ref 1', @@ -145,7 +175,7 @@ RSpec.describe ZipService, type: :zip do end let :second_referential_ok_data do { - 'Referential4/calendriers.xml' => 'calendriers', + 'Referential4/calendriers.xml' => valid_calendar, 'Referential4/commun.xml' => 'common', 'Referential4/offre_C00108_9.xml' => 'line 108 ref 2', 'Referential4/offre_C00109_10.xml' => 'line 109 ref 2' @@ -153,7 +183,7 @@ RSpec.describe ZipService, type: :zip do end let :messed_up_referential_data do { - 'Referential5/calendriers.xml' => 'calendriers', + 'Referential5/calendriers.xml' => valid_calendar, 'Referential5/commun.xml' => 'common', 'Referential5/SPURIOUS1/commun.xml' => 'common', 'Referential5/SPURIOUS2/commun.xml' => 'common', @@ -163,5 +193,21 @@ RSpec.describe ZipService, type: :zip do 'Referential5/offre_C00109_10.xml' => 'line 109 ref 1' } end + let :first_referential_no_calendar_data do + { + 'Referential6/commun.xml' => 'common', + 'Referential6/offre_C00108_9.xml' => 'line 108 ref 1', + 'Referential6/offre_C00109_10.xml' => 'line 109 ref 1' + } + end + let :first_referential_unparsable_calendar_data do + { + 'Referential7/calendriers.xml' => 'calendriers', + 'Referential7/commun.xml' => 'common', + 'Referential7/offre_C00108_9.xml' => 'line 108 ref 1', + 'Referential7/offre_C00109_10.xml' => 'line 109 ref 1' + } + end + end -- cgit v1.2.3