diff options
| -rw-r--r-- | Gemfile | 38 | ||||
| -rw-r--r-- | Gemfile.lock | 30 | ||||
| -rw-r--r-- | app/models/compliance_check.rb | 47 | ||||
| -rw-r--r-- | app/models/import.rb | 72 | ||||
| -rw-r--r-- | app/models/import_report.rb | 14 | ||||
| -rw-r--r-- | app/models/import_service.rb | 6 | ||||
| -rw-r--r-- | config/environments/development.rb | 2 | ||||
| -rw-r--r-- | config/environments/test.rb | 2 | ||||
| -rw-r--r-- | db/schema.rb | 36 | ||||
| -rw-r--r-- | lib/iev_api/client.rb | 56 | ||||
| -rw-r--r-- | lib/iev_api/configuration.rb | 1 | ||||
| -rw-r--r-- | lib/iev_api/middleware/custom_parser.rb | 37 | ||||
| -rw-r--r-- | spec/fixtures/scheduled_job.json | 574 | ||||
| -rw-r--r-- | spec/fixtures/terminated_job.json | 578 | ||||
| -rw-r--r-- | spec/models/import_service_spec.rb | 21 | ||||
| -rw-r--r-- | spec/spec_helper.rb | 1 | ||||
| -rw-r--r-- | spec/support/fake_iev_server.rb | 38 |
17 files changed, 1443 insertions, 110 deletions
@@ -1,5 +1,4 @@ source 'http://rubygems.org' -source 'https://rails-assets.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.1.9' @@ -80,24 +79,28 @@ gem 'calendar_helper', "0.2.5" gem 'cocoon' gem 'formtastic', "2.3.1" gem 'RedCloth' - -# Javascript -gem "modernizr-rails", "~> 2.0.6" -gem 'rails-assets-morrisjs', "~> 0.5.1" -gem 'rails-assets-raphael', "~> 2.1.3" - -# Use twitter bootstrap resources -gem 'rails-assets-bootstrap-sass-official', '~> 3.3.0' +gem 'simple_form', '~> 3.1.0' gem 'font-awesome-sass', '~> 4.2.0' gem 'will_paginate-bootstrap', '~> 1.0.1' -gem 'simple_form', '~> 3.1.0' -gem 'rails-assets-tagmanager', '~> 3.0.1.0' -gem 'rails-assets-typeahead.js', '~> 0.10.5' gem "breadcrumbs_on_rails" -gem 'rails-assets-typeahead.js-bootstrap3.less' -gem 'rails-assets-respond' -gem 'rails-assets-eonasdan-bootstrap-datetimepicker', '~> 3.1.3' -gem 'rails-assets-jquery-tokeninput', '~> 1.7.0' + +# TODO : Move these resources to rails assets +gem "modernizr-rails", "~> 2.0.6" + +# Javascript +source 'https://rails-assets.org' do + gem 'rails-assets-morrisjs', "~> 0.5.1" + gem 'rails-assets-raphael', "~> 2.1.3" + + # Use twitter bootstrap resources + gem 'rails-assets-bootstrap-sass-official', '~> 3.3.0' + gem 'rails-assets-tagmanager', '~> 3.0.1.0' + gem 'rails-assets-typeahead.js', '~> 0.10.5' + gem 'rails-assets-typeahead.js-bootstrap3.less' + gem 'rails-assets-respond' + gem 'rails-assets-eonasdan-bootstrap-datetimepicker', '~> 3.1.3' + gem 'rails-assets-jquery-tokeninput', '~> 1.7.0' +end # Format Output gem 'json' @@ -126,7 +129,7 @@ gem "acts_as_tree", '~> 2.1.0', :require => "acts_as_tree" gem 'rabl' gem 'delayed_job_active_record' -gem 'apartment' +gem 'apartment', "~> 1.0.0" group :development do gem 'capistrano', '2.13.5' @@ -139,6 +142,7 @@ end group :test, :development do gem "rspec-rails", "~> 3.1.0" + gem "fakeweb" gem 'capybara', "~> 2.4.0" gem 'poltergeist' gem 'launchy' diff --git a/Gemfile.lock b/Gemfile.lock index c010f01f7..5e5f6874c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -58,7 +58,7 @@ GEM acts_as_tree (2.1.0) activerecord (>= 3.0.0) addressable (2.3.7) - apartment (0.26.1) + apartment (1.0.0) activerecord (>= 3.1.2, < 5.0) rack (>= 1.3.6) arel (5.0.1.20140414130214) @@ -135,6 +135,7 @@ GEM factory_girl_rails (4.5.0) factory_girl (~> 4.5.0) railties (>= 3.0.0) + fakeweb (1.3.0) faraday (0.9.1) multipart-post (>= 1.2, < 3) faraday_middleware (0.9.1) @@ -297,7 +298,7 @@ GEM sprockets-rails (~> 2.0) rails-assets-bootstrap (3.1.1) rails-assets-jquery (>= 1.9.0) - rails-assets-bootstrap-sass-official (3.3.3) + rails-assets-bootstrap-sass-official (3.3.4) rails-assets-jquery (>= 1.9.0) rails-assets-eonasdan-bootstrap-datetimepicker (3.1.3) rails-assets-bootstrap (>= 3.0) @@ -418,8 +419,8 @@ GEM therubyrhino_jar (>= 1.7.3) therubyrhino_jar (1.7.4) thor (0.19.1) - thread_safe (0.3.4) - thread_safe (0.3.4-java) + thread_safe (0.3.5) + thread_safe (0.3.5-java) tilt (1.4.1) timers (4.0.1) hitimes @@ -465,7 +466,7 @@ DEPENDENCIES activerecord-jdbcpostgresql-adapter (~> 1.3.3) acts_as_list (~> 0.6.0) acts_as_tree (~> 2.1.0) - apartment + apartment (~> 1.0.0) breadcrumbs_on_rails calendar_helper (= 0.2.5) capistrano (= 2.13.5) @@ -482,6 +483,7 @@ DEPENDENCIES devise_invitable enumerize (~> 0.10.0) factory_girl_rails (~> 4.0) + fakeweb faraday (~> 0.9.1) faraday_middleware (~> 0.9.1) font-awesome-sass (~> 4.2.0) @@ -511,15 +513,15 @@ DEPENDENCIES poltergeist rabl rails (= 4.1.9) - rails-assets-bootstrap-sass-official (~> 3.3.0) - rails-assets-eonasdan-bootstrap-datetimepicker (~> 3.1.3) - rails-assets-jquery-tokeninput (~> 1.7.0) - rails-assets-morrisjs (~> 0.5.1) - rails-assets-raphael (~> 2.1.3) - rails-assets-respond - rails-assets-tagmanager (~> 3.0.1.0) - rails-assets-typeahead.js (~> 0.10.5) - rails-assets-typeahead.js-bootstrap3.less + rails-assets-bootstrap-sass-official (~> 3.3.0)! + rails-assets-eonasdan-bootstrap-datetimepicker (~> 3.1.3)! + rails-assets-jquery-tokeninput (~> 1.7.0)! + rails-assets-morrisjs (~> 0.5.1)! + rails-assets-raphael (~> 2.1.3)! + rails-assets-respond! + rails-assets-tagmanager (~> 3.0.1.0)! + rails-assets-typeahead.js (~> 0.10.5)! + rails-assets-typeahead.js-bootstrap3.less! rails-erd rails-i18n (~> 4.0.0) ransack diff --git a/app/models/compliance_check.rb b/app/models/compliance_check.rb new file mode 100644 index 000000000..37ec3cc66 --- /dev/null +++ b/app/models/compliance_check.rb @@ -0,0 +1,47 @@ +class ComplianceCheck + extend Enumerize + extend ActiveModel::Naming + include ActiveModel::Model + + enumerize :severity, %w{ WARNING ERROR IMPROVMENT } + enumerize :status, %w{ OK NOK UNCHECK } + + attr_reader :datas, :errors, :metadatas + + def initialize( response ) + @datas = response.datas + @errors = response.errors + @metadatas = response.metadatas + end + + def import + report_path = metadatas.find {|metatadata| "#{metadata.rel}" == "location" } + response = IevApi.request(:get, report_path, params) + Import.new(response) + end + + def warning + datas.tests.select{ |test| test[:severity] == "WARNING"} + end + + def error + datas.tests.select{ |test| test[:severity] == "ERROR"} + end + + def improvment + datas.tests.select{ |test| test[:severity] == "IMPROVMENT"} + end + + def ok + datas.tests.select{ |test| test[:result] == "OK"} + end + + def nok + datas.tests.select{ |test| test[:result] == "NOK"} + end + + def uncheck + datas.tests.select{ |test| test[:result] == "UNCHECK"} + end + +end diff --git a/app/models/import.rb b/app/models/import.rb index a27bd4c4e..93388a6f5 100644 --- a/app/models/import.rb +++ b/app/models/import.rb @@ -3,29 +3,69 @@ class Import extend ActiveModel::Naming include ActiveModel::Model - enumerize :status, in: %w{created scheduled terminated canceled aborted}, default: "created", predicates: true - enumerize :format, in: %w{neptune netex gtfs}, default: "neptune", predicates: true - - attr_reader :datas + # enumerize :status, in: %w{created scheduled terminated canceled aborted}, default: "created", predicates: true + # enumerize :format, in: %w{neptune netex gtfs}, default: "neptune", predicates: true + + attr_reader :datas, :links, :headers, :errors + + def initialize( response ) + @datas = response[:datas] + @headers = response[:headers] + @links = response[:links] + # @status = @datas.status.downcase if @datas.status? + # @format = @datas.type.downcase if @datas.type? + end - def initialize( options = Hashie::Mash.new ) - @datas = options - @status = @datas.status.downcase if @datas.status? - @format = @datas.type.downcase if @datas.type? + def report + report_path = links[:report] + if report_path + response = IevApi.request(:get, compliance_check_path, params) + ImportReport.new(response) + else + raise IevApi::IevError("Impossible to access report path link for import") + end + end + + def compliance_check + compliance_check_path = links[:validation] + if compliance_check_path + response = IevApi.request(:get, compliance_check_path, params) + ComplianceCheck.new(response) + else + raise IevApi::IevError("Impossible to access compliance check path link for import") + end end - def report - ImportReport.new( IevApi.job(referential_name, id,{ :action => "importer" }) ) + def delete + delete_path = links[:delete] + if delete_path + IevApi.request(:delete, delete_path, params) + else + raise IevApi::IevError("Impossible to access delete path link for import") + end end - # def compliance_check - # ComplianceCheck.new( IevApi.job(referential_name, { :action => "importer" }) ) - # end + def cancel + cancel_path = links[:cancel] + if cancel_path + IevApi.request(:delete, cancel_path, params) + else + raise IevApi::IevError("Impossible to access cancel path link for import") + end + end def id @datas.id end + def status + datas.status + end + + def format + datas.format + end + def filename @datas.filename end @@ -43,11 +83,7 @@ class Import 20 end end - - def links - @datas.links - end - + def referential_name @datas.referential end diff --git a/app/models/import_report.rb b/app/models/import_report.rb index 50857b4e7..a05f7abcf 100644 --- a/app/models/import_report.rb +++ b/app/models/import_report.rb @@ -1,9 +1,13 @@ class ImportReport - - attr_reader :datas + extend ActiveModel::Naming + include ActiveModel::Model + + attr_reader :datas, :errors, :metadatas - def initialize( options = Hashie::Mash.new ) - @datas = options + def initialize( response ) + @datas = response.datas + @errors = response.errors + @metadatas = response.metadatas end def zip_file @@ -35,7 +39,7 @@ class ImportReport end def lines - 1 #datas.stats.line_count if datas.stats_.line_count? + datas.stats.line_count if datas.stats_.line_count? end def routes diff --git a/app/models/import_service.rb b/app/models/import_service.rb index cbd39644c..567cd9e3e 100644 --- a/app/models/import_service.rb +++ b/app/models/import_service.rb @@ -6,15 +6,15 @@ class ImportService @referential = referential end - # Merge report import and datas from import + # Find an import whith his id def find(id) - all.find {|v| "#{v.id}" == id } + Import.new( IevApi.scheduled_job(referential.slug, id, { :action => "importer" }) ) end # Find all imports def all IevApi.jobs(referential.slug, { :action => "importer" }).map do |import_hash| - Import.new( import_hash ) + Import.new( import_hash ) end end diff --git a/config/environments/development.rb b/config/environments/development.rb index 8c7cdf6f4..1a07e864f 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -51,7 +51,7 @@ Rails.application.configure do #config.geoportail_api_key = "aaaaaaaaaaaaaa" # Iev server url - config.iev_url="localhost:8080/mobi.chouette.api" + config.iev_url="localhost:8080/chouette_iev/" # Specific theme for each company # AFIMB diff --git a/config/environments/test.rb b/config/environments/test.rb index b1745bf90..82192c9dd 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -44,7 +44,7 @@ Rails.application.configure do config.geoportail_api_key = "aaaaaaaaaaaaaa" # Iev server url - config.iev_url="localhost:8080/mobi.chouette.api" + config.iev_url="localhost:8080/chouette_iev/" # Specific theme for each company # AFIMB diff --git a/db/schema.rb b/db/schema.rb index b7feb13be..3c410cd9e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -70,8 +70,8 @@ ActiveRecord::Schema.define(version: 20150304090743) do t.integer "referential_id" t.string "token" t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end create_table "companies", force: true do |t| @@ -102,8 +102,8 @@ ActiveRecord::Schema.define(version: 20150304090743) do t.string "status" t.integer "violation_count" t.text "detail" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.string "rule_target" t.string "rule_format" t.integer "rule_level" @@ -119,8 +119,8 @@ ActiveRecord::Schema.define(version: 20150304090743) do t.integer "user_id", limit: 8 t.string "user_name" t.text "progress_info" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.string "references_type" t.string "reference_ids" end @@ -158,8 +158,8 @@ ActiveRecord::Schema.define(version: 20150304090743) do t.datetime "failed_at" t.string "locked_by" t.string "queue" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree @@ -233,8 +233,8 @@ ActiveRecord::Schema.define(version: 20150304090743) do t.string "user_name" t.text "result" t.text "progress_info" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" end create_table "jobs", force: true do |t| @@ -323,8 +323,8 @@ ActiveRecord::Schema.define(version: 20150304090743) do create_table "organisations", force: true do |t| t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.string "data_format" end @@ -346,8 +346,8 @@ ActiveRecord::Schema.define(version: 20150304090743) do create_table "referentials", force: true do |t| t.string "name" t.string "slug" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.string "prefix" t.string "projection_type" t.string "time_zone" @@ -384,8 +384,8 @@ ActiveRecord::Schema.define(version: 20150304090743) do create_table "rule_parameter_sets", force: true do |t| t.text "parameters" t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.integer "organisation_id", limit: 8 end @@ -523,8 +523,8 @@ ActiveRecord::Schema.define(version: 20150304090743) do t.datetime "last_sign_in_at" t.string "current_sign_in_ip" t.string "last_sign_in_ip" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.integer "organisation_id" t.string "name" t.string "confirmation_token" diff --git a/lib/iev_api/client.rb b/lib/iev_api/client.rb index f38d64624..1994b1027 100644 --- a/lib/iev_api/client.rb +++ b/lib/iev_api/client.rb @@ -19,8 +19,8 @@ module IevApi def url_for(endpoint, *args) path = case endpoint.to_s when 'jobs' then jobs_path(args) - when 'job' then job_path(args) - when 'report' then report_path(args) + when 'scheduled_job' then scheduled_job_path(args) + when 'terminated_job' then terminated_job_path(args) else raise ArgumentError.new("Unrecognized path: #{path}") end @@ -29,37 +29,28 @@ module IevApi def jobs(referential_id, options = {}) results = request(:get, jobs_path(referential_id), options) - results.respond_to?(:jobs) ? results.jobs : [] - end - - def job(referential_id, job_id, options = {}) - results = request(:get, job_path(referential_id, job_id), options) - if results.respond_to?(:job) - results.job - elsif results.respond_to?(:report) - results.report - else - [] - end - end - - def jobs_path(referential_id) - "/referentials/#{referential_id}/jobs" end - def job_path(referential_id, job_id) - "/referentials/#{referential_id}/jobs/#{job_id}" + def jobs_path(referential_id) + "referentials/#{referential_id}/jobs" end - def report(referential_id, report_id, options = {}) - results = request(:get, report_path(referential_id, report_id), options) - results.respond_to?(:report) ? results.report : [] + def scheduled_job(referential_id, job_id, options = {}) + results = request(:get, scheduled_job_path(referential_id, job_id), options) end - - def report_path(referential_id, report_id) - "/referentials/#{referential_id}/reports/#{report_id}" + + def scheduled_job_path(referential_id, job_id) + "referentials/#{referential_id}/scheduled_jobs/#{job_id}" end + def terminated_job(referential_id, job_id, options = {}) + results = request(:get, terminated_job_path(referential_id, job_id), options) + end + + def terminated_job_path(referential_id, job_id) + "referentials/#{referential_id}/terminated_jobs/#{job_id}" + end + def account_path "#{protocol}://#{Rails.application.config.iev_url}" end @@ -70,20 +61,17 @@ module IevApi # Perform an HTTP request def request(method, path, params = {}, options = {}) - - action_and_format = (params[:action].present? && params[:format].present?) ? "/#{params[:action]}/#{params[:format]}" : "" - build_path = connection.path_prefix + path + action_and_format response = connection(options).run_request(method, nil, nil, nil) do |request| case method when :delete, :get - request.url(build_path, params) + request.url(path, params) when :post, :put - request.url(build_path) + request.url(path) request.body = params unless params.empty? end end - + response.body end @@ -97,7 +85,7 @@ module IevApi :url => account_path, } - @connection ||= Faraday.new(default_options.deep_merge(connection_options)) do |builder| + @connection ||= Faraday.new(default_options.deep_merge(options)) do |builder| middleware.each { |mw| builder.use *mw } builder.adapter adapter @@ -109,6 +97,8 @@ module IevApi # ActiveSupport::Cache::FileStore.new cache_dir, :namespace => 'iev', # :expires_in => 3600 # one hour # end + + @connection end end diff --git a/lib/iev_api/configuration.rb b/lib/iev_api/configuration.rb index e01cbe102..b445da795 100644 --- a/lib/iev_api/configuration.rb +++ b/lib/iev_api/configuration.rb @@ -23,6 +23,7 @@ module IevApi FaradayMiddleware::FollowRedirects, FaradayMiddleware::ParseJson, IevApi::Middleware::RaiseServerError, + IevApi::Middleware::CustomParser ] def self.extended(base) diff --git a/lib/iev_api/middleware/custom_parser.rb b/lib/iev_api/middleware/custom_parser.rb new file mode 100644 index 000000000..82cf0d563 --- /dev/null +++ b/lib/iev_api/middleware/custom_parser.rb @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Expects responses like: +# +# { +# "result": { "id": 1, "name": "Tobias Fünke" }, +# "errors": [] +# } +# +require 'faraday' + +module IevApi + module Middleware + class CustomParser < Faraday::Response::Middleware + def on_complete(env) + body = env[:body] + env[:body] = { + datas: body, + headers: env[:response_headers], + links: process_links(env[:response_headers]) + } + end + + # Finds link relations from 'Link' response header + def process_links(headers) + puts headers.inspect + links = ( headers["Link"] || "" ).split(', ').map do |link| + href, name = link.match(/<(.*?)>; rel="(\w+)"/).captures + + [name.to_sym, href] + end + puts links.inspect + Hash[*links.flatten] + end + + end + end +end diff --git a/spec/fixtures/scheduled_job.json b/spec/fixtures/scheduled_job.json new file mode 100644 index 000000000..599e42862 --- /dev/null +++ b/spec/fixtures/scheduled_job.json @@ -0,0 +1,574 @@ +HTTP/1.1 200 OK +Connection: keep-alive +Cache-Control: no-transform, max-age=2147483647 +Content-Type: application/json +Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/data/9151/Citura_050115_220215.zip>; rel="data" +Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/data/9151/action_parameters.json>; rel="action_params" +Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/data/9151/validation_parameters.json>; rel="validation_params" +Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/reports/9151>; rel="location" +Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/reports/9151>; rel="delete" +Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/data/9151/validation.json>; rel="validation" +Date: Fri, 13 Mar 2015 09:18:07 GMT + +{ + "id": 9151, + "referexntial": "tatrotest", + "action": "importer", + "type": "neptune", + "created": 1425984896098, + "updated": 1425984896542, + "status": "TERMINATED", + "action_report": { + "result": "OK", + "zip_file": { + "status": "OK", + "name": "Citura_050115_220215.zip" + }, + "files": [ + { + "name": "C_NEPTUNE_reseau_5_39901717.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901712.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901718.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901710.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901709.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901727.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901746.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901719.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901715.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901716.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901721.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901734.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901725.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901731.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901711.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901722.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901724.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901733.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901726.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901732.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901736.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901708.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901730.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901720.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901745.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901713.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901723.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901729.xml", + "status": "OK", + "error": [] + } + ], + "lines": [ + { + "name": "03 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 95, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "17", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 66, + "access_point_count": 0, + "vehicle_journey_count": 45, + "journey_pattern_count": 2 + } + }, + { + "name": "TRAMWAY", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 10, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 67, + "access_point_count": 0, + "vehicle_journey_count": 769, + "journey_pattern_count": 10 + } + }, + { + "name": "02", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 3, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 68, + "access_point_count": 0, + "vehicle_journey_count": 388, + "journey_pattern_count": 3 + } + }, + { + "name": "01", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 6, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 84, + "access_point_count": 0, + "vehicle_journey_count": 385, + "journey_pattern_count": 6 + } + }, + { + "name": "10", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 6, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 79, + "access_point_count": 0, + "vehicle_journey_count": 253, + "journey_pattern_count": 6 + } + }, + { + "name": "15", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 31, + "access_point_count": 0, + "vehicle_journey_count": 8, + "journey_pattern_count": 2 + } + }, + { + "name": "13 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 22, + "access_point_count": 0, + "vehicle_journey_count": 17, + "journey_pattern_count": 2 + } + }, + { + "name": "05", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 14, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 109, + "access_point_count": 0, + "vehicle_journey_count": 378, + "journey_pattern_count": 14 + } + }, + { + "name": "02 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 68, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "08", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 9, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 104, + "access_point_count": 0, + "vehicle_journey_count": 236, + "journey_pattern_count": 9 + } + }, + { + "name": "05 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 94, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "12", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 6, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 100, + "access_point_count": 0, + "vehicle_journey_count": 236, + "journey_pattern_count": 6 + } + }, + { + "name": "13", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 4, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 101, + "access_point_count": 0, + "vehicle_journey_count": 81, + "journey_pattern_count": 4 + } + }, + { + "name": "03", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 5, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 97, + "access_point_count": 0, + "vehicle_journey_count": 387, + "journey_pattern_count": 5 + } + }, + { + "name": "07", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 4, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 105, + "access_point_count": 0, + "vehicle_journey_count": 238, + "journey_pattern_count": 4 + } + }, + { + "name": "11", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 96, + "access_point_count": 0, + "vehicle_journey_count": 251, + "journey_pattern_count": 2 + } + }, + { + "name": "09 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 29, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "CITADINE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 61, + "access_point_count": 0, + "vehicle_journey_count": 77, + "journey_pattern_count": 2 + } + }, + { + "name": "14", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 2, + "stop_area_count": 65, + "access_point_count": 0, + "vehicle_journey_count": 130, + "journey_pattern_count": 2 + } + }, + { + "name": "01 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 4, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 84, + "access_point_count": 0, + "vehicle_journey_count": 11, + "journey_pattern_count": 4 + } + }, + { + "name": "04 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 102, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "07 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 50, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "09", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 4, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 105, + "access_point_count": 0, + "vehicle_journey_count": 268, + "journey_pattern_count": 4 + } + }, + { + "name": "18", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 3, + "connection_link_count": 0, + "time_table_count": 4, + "stop_area_count": 27, + "access_point_count": 0, + "vehicle_journey_count": 8, + "journey_pattern_count": 3 + } + }, + { + "name": "04", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 8, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 112, + "access_point_count": 0, + "vehicle_journey_count": 381, + "journey_pattern_count": 8 + } + }, + { + "name": "06", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 5, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 67, + "access_point_count": 0, + "vehicle_journey_count": 279, + "journey_pattern_count": 5 + } + }, + { + "name": "16", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 4, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 63, + "access_point_count": 0, + "vehicle_journey_count": 42, + "journey_pattern_count": 4 + } + } + ], + "stats": { + "line_count": 28, + "route_count": 119, + "connection_link_count": 0, + "time_table_count": 60, + "stop_area_count": 2151, + "access_point_count": 0, + "vehicle_journey_count": 4928, + "journey_pattern_count": 119 + } + } +} diff --git a/spec/fixtures/terminated_job.json b/spec/fixtures/terminated_job.json new file mode 100644 index 000000000..417bd62ad --- /dev/null +++ b/spec/fixtures/terminated_job.json @@ -0,0 +1,578 @@ +< HTTP/1.1 200 OK +< Connection: keep-alive +< Cache-Control: no-transform, max-age=2147483647 +< X-Powered-By: Undertow/1 +* Server WildFly/8 is not blacklisted +< Server: WildFly/8 +< Transfer-Encoding: chunked +< Content-Type: application/json +< Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/data/9151/Citura_050115_220215.zip>; rel="data" +< Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/data/9151/action_parameters.json>; rel="action_params" +< Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/data/9151/validation_parameters.json>; rel="validation_params" +< Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/reports/9151>; rel="location" +< Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/reports/9151>; rel="delete" +< Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/data/9151/validation.json>; rel="validation" +< Date: Fri, 13 Mar 2015 09:18:07 GMT +< +{ + "id": 9151, + "referential": "tatrotest", + "action": "importer", + "type": "neptune", + "created": 1425984896098, + "updated": 1425984896542, + "status": "TERMINATED", + "action_report": { + "result": "OK", + "zip_file": { + "status": "OK", + "name": "Citura_050115_220215.zip" + }, + "files": [ + { + "name": "C_NEPTUNE_reseau_5_39901717.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901712.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901718.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901710.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901709.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901727.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901746.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901719.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901715.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901716.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901721.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901734.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901725.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901731.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901711.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901722.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901724.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901733.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901726.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901732.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901736.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901708.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901730.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901720.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901745.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901713.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901723.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901729.xml", + "status": "OK", + "error": [] + } + ], + "lines": [ + { + "name": "03 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 95, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "17", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 66, + "access_point_count": 0, + "vehicle_journey_count": 45, + "journey_pattern_count": 2 + } + }, + { + "name": "TRAMWAY", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 10, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 67, + "access_point_count": 0, + "vehicle_journey_count": 769, + "journey_pattern_count": 10 + } + }, + { + "name": "02", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 3, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 68, + "access_point_count": 0, + "vehicle_journey_count": 388, + "journey_pattern_count": 3 + } + }, + { + "name": "01", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 6, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 84, + "access_point_count": 0, + "vehicle_journey_count": 385, + "journey_pattern_count": 6 + } + }, + { + "name": "10", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 6, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 79, + "access_point_count": 0, + "vehicle_journey_count": 253, + "journey_pattern_count": 6 + } + }, + { + "name": "15", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 31, + "access_point_count": 0, + "vehicle_journey_count": 8, + "journey_pattern_count": 2 + } + }, + { + "name": "13 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 22, + "access_point_count": 0, + "vehicle_journey_count": 17, + "journey_pattern_count": 2 + } + }, + { + "name": "05", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 14, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 109, + "access_point_count": 0, + "vehicle_journey_count": 378, + "journey_pattern_count": 14 + } + }, + { + "name": "02 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 68, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "08", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 9, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 104, + "access_point_count": 0, + "vehicle_journey_count": 236, + "journey_pattern_count": 9 + } + }, + { + "name": "05 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 94, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "12", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 6, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 100, + "access_point_count": 0, + "vehicle_journey_count": 236, + "journey_pattern_count": 6 + } + }, + { + "name": "13", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 4, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 101, + "access_point_count": 0, + "vehicle_journey_count": 81, + "journey_pattern_count": 4 + } + }, + { + "name": "03", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 5, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 97, + "access_point_count": 0, + "vehicle_journey_count": 387, + "journey_pattern_count": 5 + } + }, + { + "name": "07", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 4, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 105, + "access_point_count": 0, + "vehicle_journey_count": 238, + "journey_pattern_count": 4 + } + }, + { + "name": "11", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 96, + "access_point_count": 0, + "vehicle_journey_count": 251, + "journey_pattern_count": 2 + } + }, + { + "name": "09 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 29, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "CITADINE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 61, + "access_point_count": 0, + "vehicle_journey_count": 77, + "journey_pattern_count": 2 + } + }, + { + "name": "14", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 2, + "stop_area_count": 65, + "access_point_count": 0, + "vehicle_journey_count": 130, + "journey_pattern_count": 2 + } + }, + { + "name": "01 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 4, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 84, + "access_point_count": 0, + "vehicle_journey_count": 11, + "journey_pattern_count": 4 + } + }, + { + "name": "04 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 102, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "07 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 50, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "09", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 4, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 105, + "access_point_count": 0, + "vehicle_journey_count": 268, + "journey_pattern_count": 4 + } + }, + { + "name": "18", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 3, + "connection_link_count": 0, + "time_table_count": 4, + "stop_area_count": 27, + "access_point_count": 0, + "vehicle_journey_count": 8, + "journey_pattern_count": 3 + } + }, + { + "name": "04", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 8, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 112, + "access_point_count": 0, + "vehicle_journey_count": 381, + "journey_pattern_count": 8 + } + }, + { + "name": "06", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 5, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 67, + "access_point_count": 0, + "vehicle_journey_count": 279, + "journey_pattern_count": 5 + } + }, + { + "name": "16", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 4, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 63, + "access_point_count": 0, + "vehicle_journey_count": 42, + "journey_pattern_count": 4 + } + } + ], + "stats": { + "line_count": 28, + "route_count": 119, + "connection_link_count": 0, + "time_table_count": 60, + "stop_area_count": 2151, + "access_point_count": 0, + "vehicle_journey_count": 4928, + "journey_pattern_count": 119 + } + } +} diff --git a/spec/models/import_service_spec.rb b/spec/models/import_service_spec.rb new file mode 100644 index 000000000..8e7c38188 --- /dev/null +++ b/spec/models/import_service_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper' + +describe Import, :type => :model do + + let(:referential) { create(:referential, :slug => "test") } + + subject { ImportService.new(referential) } + + describe '.find' do + + it "should build an import with a scheduled job" do + import = subject.find(1) + expect(import).to eq(nil) + end + + it "should build an import with a terminated job" do + end + + end + +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1f9c353dc..4af9e445c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -10,6 +10,7 @@ require 'capybara/rails' require 'capybara/poltergeist' require 'georuby-ext' require 'will_paginate/array' +require 'fakeweb' # Requires supporting ruby files with custom matchers and macros, etc, in # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are diff --git a/spec/support/fake_iev_server.rb b/spec/support/fake_iev_server.rb new file mode 100644 index 000000000..67ca201ff --- /dev/null +++ b/spec/support/fake_iev_server.rb @@ -0,0 +1,38 @@ +FakeWeb.allow_net_connect = false + +DEFAULTS = {:content_type => "application/json; charset=utf-8", :status => ["403", "Forbidden"]} + +def fixture_request(verb, url, file) + FakeWeb.register_uri(verb, url, DEFAULTS.merge(:response => File.join( File.dirname(__FILE__), "../", 'fixtures', file))) +end + +############ +# Importer +############ +# get list +fixture_request :get, "http://#{Rails.application.config.iev_url}referentials/test/scheduled_jobs?action=importer +", 'scheduled_jobs.json' +# get element +fixture_request :get, "http://#{Rails.application.config.iev_url}referentials/test/scheduled_jobs/1?action=importer +", 'scheduled_job.json' +# post element +fixture_request :post, "http://#{Rails.application.config.iev_url}referentials/test/scheduled_jobs/ +", 'scheduled_job.json' + +# Optionnels +# delete element +# cancel_element + +# error on get element +# exception server not answer + +############ +# Exporter +############ + +############ +# Validation +############ + + + |
