forked from Azure/autorest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement x-ms-parameterized-host extension for ruby (Azure#992)
* Implement x-ms-parameterized-host extension for ruby * Default value of method parameters should not be double escaped when string * Check for x-ms-skip-url-encoding should be on extension + the values (true/false)
- Loading branch information
1 parent
16eebb8
commit f41092a
Showing
8 changed files
with
331 additions
and
186 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/custom_base_uri_more_spec.rb
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,39 @@ | ||
# encoding: utf-8 | ||
|
||
$: << 'RspecTests/Generated/custom_base_uri_more' | ||
|
||
require 'custom_base_url_more_options' | ||
require 'uri' | ||
|
||
module CustomBaseUriMoreModule | ||
describe 'Custom base uri more options' do | ||
before(:all) do | ||
url = URI(ENV['StubServerURI']) | ||
@vault = "http://#{url.host}" | ||
@key_name = "key1" | ||
|
||
dummyToken = 'dummy12321343423' | ||
@credentials = MsRest::TokenCredentials.new(dummyToken) | ||
|
||
client = CustomBaseUriMoreModule::AutoRestParameterizedCustomHostTestClient.new(@credentials) | ||
client.subscription_id = 'test12' | ||
client.instance_variable_set("@dns_suffix", ":#{url.port.to_s}") | ||
@custom_base_url_client = CustomBaseUriMoreModule::Paths.new(client) | ||
end | ||
|
||
it 'should get empty' do | ||
result = @custom_base_url_client.get_empty_async(@vault, '', @key_name).value! | ||
expect(result.response.status).to eq(200) | ||
end | ||
|
||
it 'should throw on nil vault or secret' do | ||
expect { | ||
@custom_base_url_client.get_empty_async(nil, nil, @key_name).value! | ||
}.to raise_error(ArgumentError) | ||
|
||
expect { | ||
@custom_base_url_client.get_empty_async(@vault, nil, @key_name).value! | ||
}.to raise_error(ArgumentError) | ||
end | ||
end | ||
end |
33 changes: 33 additions & 0 deletions
33
AutoRest/Generators/Ruby/Azure.Ruby.Tests/RspecTests/custom_base_uri_spec.rb
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,33 @@ | ||
# encoding: utf-8 | ||
|
||
$: << 'RspecTests/Generated/custom_base_uri' | ||
|
||
require 'custom_base_url' | ||
require 'uri' | ||
|
||
module CustomBaseUriModule | ||
describe 'Custom base uri' do | ||
before(:all) do | ||
url = URI(ENV['StubServerURI']) | ||
@account_name = url.host | ||
|
||
dummyToken = 'dummy12321343423' | ||
@credentials = MsRest::TokenCredentials.new(dummyToken) | ||
|
||
client = CustomBaseUriModule::AutoRestParameterizedHostTestClient.new(@credentials) | ||
client.instance_variable_set("@host", ":#{url.port.to_s}") | ||
@custom_base_url_client = CustomBaseUriModule::Paths.new(client) | ||
end | ||
|
||
it 'should get empty' do | ||
result = @custom_base_url_client.get_empty_async(@account_name).value! | ||
expect(result.response.status).to eq(200) | ||
end | ||
|
||
it 'should throw on nil account name' do | ||
expect { | ||
@custom_base_url_client.get_empty_async(nil).value! | ||
}.to raise_error(ArgumentError) | ||
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.