forked from loafle/openapi-generator-original
update tests
This commit is contained in:
@@ -27,31 +27,31 @@ describe Petstore::Configuration do
|
||||
|
||||
describe '#base_url' do
|
||||
it 'should have the default value' do
|
||||
expect(config.base_url).to eq("http://petstore.swagger.io/v2")
|
||||
expect(config.base_url).to eq("http://localhost/v2")
|
||||
end
|
||||
|
||||
it 'returns default value when invalid operation is passed' do
|
||||
expect(config.base_url('invalid_operation')).to eq('http://petstore.swagger.io/v2')
|
||||
expect(config.base_url('invalid_operation')).to eq('http://localhost/v2')
|
||||
end
|
||||
|
||||
it 'returns proper URL default server_index' do
|
||||
expect(config.base_url(:'PetApi.add_pet')).to eq('http://petstore.swagger.io/v2')
|
||||
expect(config.base_url(:'PetApi.add_pet')).to eq('http://localhost/v2')
|
||||
end
|
||||
|
||||
it 'returns proper URL when server_index is set' do
|
||||
config.server_index = 1
|
||||
config.server_index = 2
|
||||
expect(config.base_url(:'PetApi.add_pet')).to eq('http://path-server-test.petstore.local/v2')
|
||||
end
|
||||
|
||||
it 'returns proper URL when server_operation_index is set' do
|
||||
config.server_operation_index = {
|
||||
:'PetApi.add_pet' => 1
|
||||
:'PetApi.add_pet' =>2
|
||||
}
|
||||
expect(config.base_url(:'PetApi.add_pet')).to eq('http://path-server-test.petstore.local/v2')
|
||||
end
|
||||
|
||||
it 'returns proper URL from server_settings when server_index is set' do
|
||||
config.server_index = 1
|
||||
config.server_index = 2
|
||||
expect(config.base_url).to eq('https://localhost:8080/v2')
|
||||
end
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ describe "Pet" do
|
||||
expect(index_backup).to eq({})
|
||||
# test operation index 1 (invalid path)
|
||||
@pet_api.api_client.config.server_operation_index = {
|
||||
:'PetApi.get_pet_by_id' => 1
|
||||
:'PetApi.get_pet_by_id' => 2
|
||||
}
|
||||
|
||||
expect(@pet_api.api_client.config.base_url(:'PetApi.get_pet_by_id')).to eq('http://path-server-test.petstore.local/v2')
|
||||
@@ -86,7 +86,7 @@ describe "Pet" do
|
||||
expect(index_backup).to eq({})
|
||||
# test operation index 3
|
||||
@pet_api.api_client.config.server_operation_index = {
|
||||
:'PetApi.get_pet_by_id' => 3
|
||||
:'PetApi.get_pet_by_id' => 4
|
||||
}
|
||||
|
||||
expect(@pet_api.api_client.config.base_url(:'PetApi.get_pet_by_id')).to eq('http://path.v2.test.openapi-generator.tech/v2')
|
||||
|
||||
Reference in New Issue
Block a user