1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Simple request tests

This commit is contained in:
Keith Barrette 2013-02-17 15:27:27 -05:00
parent 43aa7c7abb
commit 42c4492db8
2 changed files with 98 additions and 0 deletions

View file

@ -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

View file

@ -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