Add server URL without variables to the test spec (#7517)

* add server url without variables to the test spec

* fix php tests

* fix tests

* fix assertion
This commit is contained in:
William Cheng
2020-09-28 22:06:42 +08:00
committed by GitHub
parent 785cbbbb63
commit d7dfcc20c0
16 changed files with 59 additions and 4 deletions

View File

@@ -1135,6 +1135,8 @@ servers:
- 'v1'
- 'v2'
default: 'v2'
- url: https://127.0.0.1/no_variable
description: The local server without variables
components:
requestBodies:
UserArray:

View File

@@ -1120,6 +1120,8 @@ servers:
- 'v1'
- 'v2'
default: 'v2'
- url: https://127.0.0.1/no_variable
description: The local server without variables
components:
requestBodies:
UserArray:

View File

@@ -1142,6 +1142,8 @@ servers:
- 'v1'
- 'v2'
default: 'v2'
- url: https://127.0.0.1/no_varaible
description: The local server without variables
components:
requestBodies:
UserArray:

View File

@@ -167,6 +167,12 @@ namespace Org.OpenAPITools.Client
}
}
}
},
{
new Dictionary<string, object> {
{"url", "https://127.0.0.1/no_variable"},
{"description", "The local server without variables"},
}
}
};

View File

@@ -172,6 +172,12 @@ namespace Org.OpenAPITools.Client
}
}
}
},
{
new Dictionary<string, object> {
{"url", "https://127.0.0.1/no_variable"},
{"description", "The local server without variables"},
}
}
};

View File

@@ -615,6 +615,10 @@ class ApiClient {
]
}
}
},
{
'url': "https://127.0.0.1/no_varaible",
'description': "The local server without variables",
}
];
}

View File

@@ -616,6 +616,10 @@ class ApiClient {
]
}
}
},
{
'url': "https://127.0.0.1/no_varaible",
'description': "The local server without variables",
}
];
}

View File

@@ -474,6 +474,10 @@ class Configuration
]
]
]
],
[
"url" => "https://127.0.0.1/no_varaible",
"description" => "The local server without variables",
]
];
}

View File

@@ -15,7 +15,7 @@ class ConfigurationTest extends TestCase
$config = new Configuration();
$servers = $config->getHostSettings();
$this->assertCount(2, $servers);
$this->assertCount(3, $servers);
$this->assertSame("http://{server}.swagger.io:{port}/v2", $servers[0]["url"]);
$this->assertSame("petstore", $servers[0]["variables"]["server"]["default_value"]);
$this->assertSame("80", $servers[0]["variables"]["port"]["default_value"]);
@@ -47,13 +47,13 @@ class ConfigurationTest extends TestCase
public function testInvalidIndex()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Invalid index 2 when selecting the host. Must be less than 2');
$this->expectExceptionMessage('Invalid index 3 when selecting the host. Must be less than 3');
$config = new Configuration();
$url = $config->getHostFromSettings(2);
$url = $config->getHostFromSettings(3);
}
/**
* Test host settings with invalid vaues
* Test host settings with invalid values
*/
public function testHostUrlWithInvalidValues()
{

View File

@@ -286,6 +286,10 @@ module Petstore
]
}
}
},
{
url: "https://127.0.0.1/no_varaible",
description: "The local server without variables",
}
]
end

View File

@@ -291,6 +291,10 @@ module Petstore
]
}
}
},
{
url: "https://127.0.0.1/no_varaible",
description: "The local server without variables",
}
]
end

View File

@@ -31,6 +31,8 @@ servers:
enum:
- v1
- v2
- description: The local server without variables
url: https://127.0.0.1/no_variable
tags:
- description: Everything about your Pets
name: pet

View File

@@ -141,6 +141,10 @@ func NewConfiguration() *Configuration {
},
},
},
{
URL: "https://127.0.0.1/no_variable",
Description: "The local server without variables",
},
},
OperationServers: map[string]ServerConfigurations{
"PetApiService.AddPet": {

View File

@@ -31,6 +31,8 @@ servers:
enum:
- v1
- v2
- description: The local server without variables
url: https://127.0.0.1/no_variable
tags:
- description: Everything about your Pets
name: pet

View File

@@ -116,6 +116,11 @@ public class ApiClient extends JavaTimeFormatter {
)
));
}}
),
new ServerConfiguration(
"https://127.0.0.1/no_variable",
"The local server without variables",
new HashMap<String, ServerVariable>()
)
));
protected Integer serverIndex = 0;

View File

@@ -556,6 +556,10 @@ conf = petstore_api.Configuration(
]
}
}
},
{
'url': "https://127.0.0.1/no_varaible",
'description': "The local server without variables",
}
]