-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Service specific protocol tests (#3049)
- Loading branch information
Showing
13 changed files
with
724 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative 'spec_helper' | ||
|
||
module Aws | ||
module APIGateway | ||
describe Client do | ||
|
||
let(:client) { Client.new(stub_responses: true) } | ||
|
||
# { | ||
# id: "ApiGatewayAccept", | ||
# documentation: "API Gateway requires that this Accept header is set on all requests.", | ||
# protocol: restJson1, | ||
# method: "GET", | ||
# uri: "/restapis", | ||
# headers: { | ||
# "Accept": "application/json", | ||
# }, | ||
# body: "", | ||
# params: {}, | ||
# } | ||
it 'ApiGatewayAccept' do | ||
resp = client.get_rest_apis | ||
request = resp.context.http_request | ||
expect(request.headers['accept']).to eq('application/json') | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative 'spec_helper' | ||
|
||
module Aws | ||
module Glacier | ||
describe Client do | ||
|
||
let(:client) { Client.new(stub_responses: true) } | ||
|
||
describe '#upload_archive' do | ||
# { | ||
# id: "GlacierVersionHeader", | ||
# documentation: "Glacier requires that a version header be set on all requests.", | ||
# protocol: restJson1, | ||
# method: "POST", | ||
# uri: "/foo/vaults/bar/archives", | ||
# headers: { | ||
# "X-Amz-Glacier-Version": "2012-06-01", | ||
# }, | ||
# body: "", | ||
# params: { | ||
# accountId: "foo", | ||
# vaultName: "bar", | ||
# }, | ||
# }, | ||
it 'GlacierVersionHeader' do | ||
resp = client.upload_archive( | ||
account_id: 'foo', | ||
vault_name: 'bar' | ||
) | ||
request = resp.context.http_request | ||
expect(request.headers['x-amz-glacier-version']).to eq('2012-06-01') | ||
end | ||
|
||
# { | ||
# id: "GlacierChecksums", | ||
# documentation: "Glacier requires checksum headers that are cumbersome to provide.", | ||
# protocol: restJson1, | ||
# method: "POST", | ||
# uri: "/foo/vaults/bar/archives", | ||
# headers: { | ||
# "X-Amz-Glacier-Version": "2012-06-01", | ||
# "X-Amz-Content-Sha256": "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", | ||
# "X-Amz-Sha256-Tree-Hash": "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", | ||
# }, | ||
# body: "hello world", | ||
# params: { | ||
# accountId: "foo", | ||
# vaultName: "bar", | ||
# body: "hello world" | ||
# }, | ||
# appliesTo: "client", | ||
# }, | ||
it 'GlacierChecksums' do | ||
resp = client.upload_archive( | ||
account_id: 'foo', | ||
vault_name: 'bar', | ||
body: 'hello world' | ||
) | ||
request = resp.context.http_request | ||
expect(request.headers['x-amz-glacier-version']).to eq('2012-06-01') | ||
expect(request.headers['x-amz-content-sha256']) | ||
.to eq('b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9') | ||
expect(request.headers['x-amz-sha256-tree-hash']) | ||
.to eq('b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9') | ||
end | ||
|
||
# { | ||
# id: "GlacierAccountId", | ||
# documentation: """ | ||
# Glacier requires that the account id be set, but you can just use a | ||
# hyphen (-) to indicate the current account. This should be default | ||
# behavior if the customer provides a null or empty string.""", | ||
# protocol: restJson1, | ||
# method: "POST", | ||
# uri: "/-/vaults/bar/archives", | ||
# headers: { | ||
# "X-Amz-Glacier-Version": "2012-06-01", | ||
# }, | ||
# body: "", | ||
# params: { | ||
# accountId: "", | ||
# vaultName: "bar", | ||
# }, | ||
# appliesTo: "client", | ||
# } | ||
it 'GlacierAccountId' do | ||
resp = client.upload_archive( | ||
account_id: '', | ||
vault_name: 'bar' | ||
) | ||
request = resp.context.http_request | ||
expect(request.headers['x-amz-glacier-version']).to eq('2012-06-01') | ||
expect(request.endpoint.path).to eq('/-/vaults/bar/archives') | ||
end | ||
end | ||
|
||
describe '#upload_multipart_part' do | ||
# { | ||
# id: "GlacierMultipartChecksums", | ||
# documentation: "Glacier requires checksum headers that are cumbersome to provide.", | ||
# protocol: restJson1, | ||
# method: "PUT", | ||
# uri: "/foo/vaults/bar/multipart-uploads/baz", | ||
# headers: { | ||
# "X-Amz-Glacier-Version": "2012-06-01", | ||
# "X-Amz-Content-Sha256": "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", | ||
# "X-Amz-Sha256-Tree-Hash": "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", | ||
# }, | ||
# body: "hello world", | ||
# params: { | ||
# accountId: "foo", | ||
# vaultName: "bar", | ||
# uploadId: "baz", | ||
# body: "hello world" | ||
# }, | ||
# appliesTo: "client", | ||
# } | ||
it 'GlacierMultipartChecksums' do | ||
resp = client.upload_multipart_part( | ||
account_id: 'foo', | ||
vault_name: 'bar', | ||
upload_id: 'baz', | ||
body: 'hello world' | ||
) | ||
request = resp.context.http_request | ||
expect(request.headers['x-amz-glacier-version']).to eq('2012-06-01') | ||
expect(request.headers['x-amz-content-sha256']) | ||
.to eq('b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9') | ||
expect(request.headers['x-amz-sha256-tree-hash']) | ||
.to eq('b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9') | ||
end | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative 'spec_helper' | ||
|
||
module Aws | ||
module MachineLearning | ||
describe Client do | ||
|
||
let(:client) { Client.new(stub_responses: true) } | ||
|
||
describe '#predict' do | ||
# { | ||
# id: "MachinelearningPredictEndpoint", | ||
# documentation: """ | ||
# MachineLearning's api makes use of generated endpoints that the | ||
# customer is then expected to use for the Predict operation. Having | ||
# to alter the endpoint for a specific operation would be cumbersome, | ||
# so an AWS client should be able to do it for them.""", | ||
# protocol: awsJson1_1, | ||
# method: "POST", | ||
# uri: "/", | ||
# host: "example.com", | ||
# resolvedHost: "custom.example.com", | ||
# body: "{\"MLModelId\": \"foo\", \"Record\": {}, \"PredictEndpoint\": \"https://custom.example.com/\"}", | ||
# bodyMediaType: "application/json", | ||
# headers: {"Content-Type": "application/x-amz-json-1.1"}, | ||
# params: { | ||
# MLModelId: "foo", | ||
# Record: {}, | ||
# PredictEndpoint: "https://custom.example.com/", | ||
# } | ||
# } | ||
it 'MachinelearningPredictEndpoint' do | ||
endpoint = 'https://custom.example.com/' | ||
body = '{"MLModelId":"foo","Record":{},"PredictEndpoint":"https://custom.example.com/"}' | ||
headers = { 'Content-Type' => 'application/x-amz-json-1.1' } | ||
resp = client.predict( | ||
ml_model_id: 'foo', | ||
record: {}, | ||
predict_endpoint: endpoint | ||
) | ||
request = resp.context.http_request | ||
expect(request.endpoint.to_s).to eq(endpoint) | ||
expect(request.body_contents).to eq(body) | ||
expect(request.headers['content-type']).to eq(headers['Content-Type']) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.