From 42c4492db8ee275a9c19a972f7d4a761911e3dc6 Mon Sep 17 00:00:00 2001 From: Keith Barrette Date: Sun, 17 Feb 2013 15:27:27 -0500 Subject: [PATCH] Simple request tests --- tests/aws/requests/data_pipeline/helper.rb | 44 +++++++++++++++ .../requests/data_pipeline/pipeline_tests.rb | 54 +++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 tests/aws/requests/data_pipeline/helper.rb create mode 100644 tests/aws/requests/data_pipeline/pipeline_tests.rb diff --git a/tests/aws/requests/data_pipeline/helper.rb b/tests/aws/requests/data_pipeline/helper.rb new file mode 100644 index 000000000..08fe714bd --- /dev/null +++ b/tests/aws/requests/data_pipeline/helper.rb @@ -0,0 +1,44 @@ +class AWS + module DataPipeline + module Formats + + BASIC = { + 'pipelineId' => String, + } + + LIST_PIPELINES = { + "hasMoreResults" => Fog::Nullable::Boolean, + "marker" => Fog::Nullable::String, + "pipelineIdList" => [ + { + "id" => String, + "name" => String, + } + ] + } + + DESCRIBE_PIPELINES = { + "pipelineDescriptionList" => [ + { + "description" => Fog::Nullable::String, + "name" => String, + "pipelineId" => String, + "fields" => [ + { + "key" => String, + "refValue" => Fog::Nullable::String, + "stringValue" => Fog::Nullable::String, + } + ] + } + ] + } + + PUT_PIPELINE_DEFINITION = { + "errored" => Fog::Boolean, + "validationErrors" => Fog::Nullable::Array, + } + + end + end +end diff --git a/tests/aws/requests/data_pipeline/pipeline_tests.rb b/tests/aws/requests/data_pipeline/pipeline_tests.rb new file mode 100644 index 000000000..503a4b367 --- /dev/null +++ b/tests/aws/requests/data_pipeline/pipeline_tests.rb @@ -0,0 +1,54 @@ +Shindo.tests('AWS::DataPipeline | pipeline_tests', ['aws', 'data_pipeline']) do + pending if Fog.mocking? + + @pipeline_id = nil + + tests('success') do + tests("#create_pipeline").formats(AWS::DataPipeline::Formats::BASIC) do + unique_id = 'fog-test-pipeline-unique-id' + name = 'fog-test-pipeline-name' + description = 'Fog test pipeline' + + result = Fog::AWS[:data_pipeline].create_pipeline(unique_id, name, description) + @pipeline_id = result['pipelineId'] + result + end + + tests("#list_pipelines").formats(AWS::DataPipeline::Formats::LIST_PIPELINES) do + Fog::AWS[:data_pipeline].list_pipelines() + end + + tests("#describe_pipelines").formats(AWS::DataPipeline::Formats::DESCRIBE_PIPELINES) do + ids = [@pipeline_id] + Fog::AWS[:data_pipeline].describe_pipelines(ids) + end + + tests("#put_pipeline_definition").formats(AWS::DataPipeline::Formats::PUT_PIPELINE_DEFINITION) do + objects = [ + { + "id" => "Nightly", + "type" => "Schedule", + "startDateTime" => Time.now.strftime("%Y-%m-%dT%H:%M:%S"), + "period" => "24 hours", + }, + { + "id" => "Default", + "role" => "role-dumps", + "resourceRole" => "role-dumps-inst", + "schedule" => { "ref" => "Nightly" }, + }, + ] + + Fog::AWS[:data_pipeline].put_pipeline_definition(@pipeline_id, objects) + end + + tests("#activate_pipeline") do + Fog::AWS[:data_pipeline].activate_pipeline(@pipeline_id) + end + + tests("#delete_pipeline") do + Fog::AWS[:data_pipeline].delete_pipeline(@pipeline_id) + end + + end +end