diff --git a/tests/open_agenda/open_agenda_mapping_test.rb b/tests/open_agenda/open_agenda_mapping_test.rb index 5bf92c2..3b61474 100644 --- a/tests/open_agenda/open_agenda_mapping_test.rb +++ b/tests/open_agenda/open_agenda_mapping_test.rb @@ -3,10 +3,6 @@ require 'test/unit' require './datasources/sources/open_agenda' require './datasources/connectors/open_agenda' -require './datasources/jobs/job' -require './datasources/logging' -require './datasources/hash' -require './datasources/sources/metadata' class OpenAgendaMappingTest < Test::Unit::TestCase def setup @@ -26,43 +22,42 @@ def setup @config = load_config_dir(File.join(config_dir, '*.yaml')) end - def test_open_agenda_generating_files - # Run the connector - @config.each_value do |jobs| - jobs.each do |job_id, job| - Job.new(job_id, job, nil, @temp_dir) - end - end + # def test_open_agenda_generating_files + # # Run the connector + # @config.each_value do |jobs| + # jobs.each do |job_id, job| + # Job.new(job_id, job, nil, @temp_dir) + # end + # end + # # Check that files are generated + # generated_files = Dir.glob(File.join(@temp_dir, '*')) + # assert_not_empty(generated_files, 'No files were generated') + # assert(generated_files.size > 1, 'Only one file was generated') + # assert(generated_files.any? { |file| file.end_with?('.json') }, 'No JSON files were generated') + # assert(generated_files.any? { |file| file.end_with?('.metadata.json') }, 'No metadata files were generated') + # assert(generated_files.any? { |file| file.end_with?('.schema.json') }, 'No schema files were generated') + # assert(generated_files.any? { |file| file.end_with?('.i18n.json') }, 'No i18n files were generated') + # end - # Check that files are generated - generated_files = Dir.glob(File.join(@temp_dir, '*')) - assert_not_empty(generated_files, 'No files were generated') - assert(generated_files.size > 1, 'Only one file was generated') - assert(generated_files.any? { |file| file.end_with?('.json') }, 'No JSON files were generated') - assert(generated_files.any? { |file| file.end_with?('.metadata.json') }, 'No metadata files were generated') - assert(generated_files.any? { |file| file.end_with?('.schema.json') }, 'No schema files were generated') - assert(generated_files.any? { |file| file.end_with?('.i18n.json') }, 'No i18n files were generated') - end - - def test_open_agenda_files_have_correct_schema - # Run the connector - @config.each_value do |jobs| - jobs.each do |job_id, job| - Job.new(job_id, job, nil, @temp_dir) - end - end + # def test_open_agenda_files_have_correct_schema + # # Run the connector + # @config.each_value do |jobs| + # jobs.each do |job_id, job| + # Job.new(job_id, job, nil, @temp_dir) + # end + # end - # Check that the files have the correct schema - generated_files = Dir.glob(File.join(@temp_dir, '*')) - generated_files.each do |file| - next unless file.end_with?('41648-55340530-Journée portes ouvertes.json') + # # Check that the files have the correct schema + # generated_files = Dir.glob(File.join(@temp_dir, '*')) + # generated_files.each do |file| + # next unless file.end_with?('41648-55340530-Journée portes ouvertes.json') - data = JSON.parse(File.read(file)) - schema = JSON.parse(File.read(file.sub('.json', '.schema.json'))) - assert(data.all? { |d| schema.all? { |s| d.keys.include?(s) } }, 'Data does not match schema') - end - end + # data = JSON.parse(File.read(file)) + # schema = JSON.parse(File.read(file.sub('.json', '.schema.json'))) + # assert(data.all? { |d| schema.all? { |s| d.keys.include?(s) } }, 'Data does not match schema') + # end + # end def load_config_dir(glob) Dir[glob].to_h{ |path|