spec/integration/schedule_spec.rb in gooddata-0.6.25 vs spec/integration/schedule_spec.rb in gooddata-0.6.26

- old
+ new

@@ -22,11 +22,10 @@ before(:each) do @client = ConnectionHelper.create_default_connection @project = ProjectHelper.get_default_project(:client => @client) - @project_executable = 'graph/graph.grf' @test_cron = '0 15 27 7 *' @test_data = { :timezone => 'UTC', :cron => '2 2 2 2 *', :client => @client, @@ -85,31 +84,31 @@ end describe '#create' do it 'Creates new schedule if mandatory params passed' do begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data) expect(schedule).to be_truthy ensure schedule && schedule.delete end end it 'Creates new schedule if mandatory params passed and optional params are present' do begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data_with_optional_param) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data_with_optional_param) expect(schedule).to be_truthy ensure schedule && schedule.delete end end it 'Throws exception when no process ID specified' do schedule = nil begin expect { - schedule = @project.create_schedule(nil, @test_cron, @project_executable, @test_data) + schedule = @project.create_schedule(nil, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data) }.to raise_error 'Process ID has to be provided' ensure schedule && schedule.delete end end @@ -129,20 +128,20 @@ data = GoodData::Helpers.deep_dup(@test_data) data[:cron] = nil schedule = nil begin expect { - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, nil, @project_executable, data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, nil, ProcessHelper::DEPLOY_NAME, data) }.to raise_error 'Trigger schedule has to be provided' ensure schedule && schedule.delete end end it 'Throws exception when no timezone specified' do data = GoodData::Helpers.deep_dup(@test_data) - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, data) schedule.timezone = nil begin expect { schedule.save }.to raise_error 'A timezone has to be provided' @@ -153,11 +152,11 @@ it 'Throws exception when no schedule type is specified' do schedule = nil data = GoodData::Helpers.deep_dup(@test_data) begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, data) schedule.type = nil expect { schedule.save }.to raise_error 'Schedule type has to be provided' ensure @@ -167,11 +166,11 @@ end describe '#cron' do it 'Should return cron as string' do begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data) res = schedule.cron res.should_not be_nil res.should_not be_empty res.should be_a_kind_of(String) expect(schedule.time_based?).to be_truthy @@ -184,11 +183,11 @@ describe '#cron=' do it 'Assigns the cron and marks the object dirty' do test_cron = '2 2 2 2 *' begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data) schedule.cron = test_cron expect(schedule.cron).to eq(test_cron) expect(schedule.dirty).to eq(true) ensure schedule && schedule.delete @@ -197,11 +196,11 @@ end describe '#executable' do it 'Should return executable as string' do begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data) res = schedule.executable res.should_not be_nil res.should_not be_empty res.should be_a_kind_of(String) ensure @@ -213,11 +212,11 @@ describe '#executable=' do it 'Assigns the executable and marks the object dirty' do test_executable = 'this/is/test.grf' begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data) schedule.executable = test_executable expect(schedule.executable).to eq(test_executable) expect(schedule.dirty).to eq(true) ensure schedule && schedule.delete @@ -258,11 +257,11 @@ end describe '#execution_url' do it 'Should return execution URL as string' do begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data) res = schedule.execution_url res.should_not be_nil res.should_not be_empty res.should be_a_kind_of(String) ensure @@ -272,11 +271,11 @@ end describe '#type' do it 'Should return execution type as string' do begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data) res = schedule.type res.should_not be_nil res.should be_a_kind_of(String) ensure schedule && schedule.delete @@ -285,11 +284,11 @@ end describe '#hidden_params' do it 'Should return execution hidden_params as hash' do begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data) res = schedule.hidden_params res.should_not be_nil res.should be_a_kind_of(Hash) ensure schedule && schedule.delete @@ -298,11 +297,11 @@ end describe '#hidden_params=' do it 'Assigns the hidden params and marks the object dirty' do begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data) old_params = schedule.hidden_params test_params = { 'PROCESS_ID' => '1-2-3-4' } @@ -317,11 +316,11 @@ end describe '#set_hidden_parameter' do it 'Assigns the hidden parameter and marks the object dirty' do begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data) old_params = schedule.hidden_params test_parameter = {'test_parameter' => 'just_testing' } schedule.set_hidden_parameter(test_parameter.keys.first, test_parameter.values.first) expect(schedule.hidden_params).to eq(old_params.merge(test_parameter)) @@ -333,11 +332,11 @@ end describe '#set_parameter' do it 'Assigns the hidden parameter and marks the object dirty' do begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data) old_params = schedule.params test_parameter = {'test_parameter' => 'just_testing' } schedule.set_parameter(test_parameter.keys.first, test_parameter.values.first) expect(schedule.params).to eq(old_params.merge(test_parameter)) @@ -350,11 +349,11 @@ describe '#params' do it 'Should return execution params as hash' do begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data) res = schedule.params res.should_not be_nil res.should_not be_empty res.should be_a_kind_of(Hash) ensure @@ -364,11 +363,11 @@ end describe '#params=' do it 'Assigns the params and marks the object dirty' do begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data) old_params = schedule.params test_params = { 'some_new_param' => '1-2-3-4' } @@ -385,11 +384,11 @@ end describe '#process_id' do it 'Should return process id as string' do begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data) res = schedule.process_id res.should_not be_nil res.should_not be_empty res.should be_a_kind_of(String) ensure @@ -401,11 +400,11 @@ describe '#process_id=' do it 'Assigns the process_id and marks the object dirty' do test_process_id = '1-2-3-4' begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data) schedule.process_id = test_process_id expect(schedule.process_id).to eq(test_process_id) expect(schedule.dirty).to eq(true) ensure schedule && schedule.delete @@ -414,11 +413,11 @@ end describe '#save' do it 'Should save a schedule' do begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data) expect(@project.schedules(schedule.uri)).to eq schedule expect(@project.schedules).to include(schedule) ensure schedule && schedule.delete end @@ -426,11 +425,11 @@ end describe '#state' do it 'Should return execution state as string' do begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data) res = schedule.state res.should_not be_nil res.should_not be_empty res.should be_a_kind_of(String) ensure @@ -440,11 +439,11 @@ end describe '#type' do it 'Should return execution type as string' do begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data) res = schedule.type res.should_not be_nil res.should_not be_empty res.should be_a_kind_of(String) ensure @@ -456,11 +455,11 @@ describe '#type=' do it 'Assigns the type the object dirty' do test_type = 'TEST' begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data) schedule.type = test_type expect(schedule.type).to eq(test_type) expect(schedule.dirty).to eq(true) ensure schedule && schedule.delete @@ -469,11 +468,11 @@ end describe '#timezone' do it 'Should return timezone as string' do begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data) res = schedule.timezone res.should_not be_nil res.should_not be_empty res.should be_a_kind_of(String) ensure @@ -485,11 +484,11 @@ describe '#timezone=' do it 'Assigns the timezone and marks the object dirty' do test_timezone = 'PST' begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data) schedule.timezone = test_timezone expect(schedule.timezone).to eq(test_timezone) expect(schedule.dirty).to eq(true) ensure schedule && schedule.delete @@ -498,11 +497,11 @@ end describe '#reschedule' do it 'Should return reschedule as integer' do begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data_with_optional_param) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data_with_optional_param) res = schedule.reschedule res.should_not be_nil res.should be_a_kind_of(Integer) ensure schedule && schedule.delete @@ -513,11 +512,11 @@ describe '#reschedule=' do it 'Assigns the reschedule and marks the object dirty' do test_reschedule = 45 begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data_with_optional_param) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data_with_optional_param) schedule.reschedule = test_reschedule expect(schedule.reschedule).to eq(test_reschedule) expect(schedule.dirty).to eq(true) ensure schedule && schedule.delete @@ -526,11 +525,11 @@ end describe '#executions' do it 'Returns executions' do begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data_with_optional_param) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data_with_optional_param) expect(schedule.executions.to_a).to be_empty schedule.execute ensure schedule && schedule.delete end @@ -538,20 +537,20 @@ end describe '#name' do it 'should be able to get name of the schedule.' do begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data_with_optional_param) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data_with_optional_param) expect(schedule.name).to eq 'graph.grf' ensure schedule && schedule.delete end end it 'should be able to return your name if specified during creation.' do begin - schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data_with_optional_param.merge(name: 'My schedule name')) + schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data_with_optional_param.merge(name: 'My schedule name')) expect(schedule.name).to eq 'My schedule name' ensure schedule && schedule.delete end end @@ -559,11 +558,11 @@ describe '#trigger_id=' do it 'should be able to set trigger_id of the schedule.' do begin process = @project.processes(ProcessHelper::PROCESS_ID) - schedule = process.create_schedule(@test_cron, @project_executable, @test_data_with_optional_param) + schedule = process.create_schedule(@test_cron, ProcessHelper::DEPLOY_NAME, @test_data_with_optional_param) expect(schedule.dirty).to be_falsey schedule.trigger_id = 'some_other_id' expect(schedule.dirty).to be_truthy ensure schedule && schedule.delete @@ -573,11 +572,11 @@ describe '#trigger_id=' do it 'should be able to set trigger_id of the schedule.' do begin process = @project.processes(ProcessHelper::PROCESS_ID) - schedule = process.create_schedule(@test_cron, @project_executable, @test_data_with_optional_param) + schedule = process.create_schedule(@test_cron, ProcessHelper::DEPLOY_NAME, @test_data_with_optional_param) expect(schedule.dirty).to be_falsey schedule.trigger_id = 'some_other_id' expect(schedule.dirty).to be_truthy ensure schedule && schedule.delete @@ -587,11 +586,11 @@ describe '#name=' do it 'should be able to set name of the schedule.' do begin process = @project.processes(ProcessHelper::PROCESS_ID) - schedule = process.create_schedule(@test_cron, @project_executable, @test_data_with_optional_param) + schedule = process.create_schedule(@test_cron, ProcessHelper::DEPLOY_NAME, @test_data_with_optional_param) expect(schedule.name).to eq 'graph.grf' schedule.name = 'MY NAME' schedule.save schedule2 = process.schedules.find { |s| s.obj_id == schedule.obj_id } expect(schedule2.name).to eq 'MY NAME' @@ -603,10 +602,10 @@ describe '#disable' do it 'should preserve the hidden parmeters.' do begin process = @project.processes(ProcessHelper::PROCESS_ID) - schedule = process.create_schedule(@test_cron, @project_executable, @test_data_with_optional_param.merge({hidden_params: { + schedule = process.create_schedule(@test_cron, ProcessHelper::DEPLOY_NAME, @test_data_with_optional_param.merge({hidden_params: { "a" => { "b" => "c" } }}))