forked from loafle/openapi-generator-original
Remove tests replaces with Python sample testing (#17453)
This commit is contained in:
@@ -402,29 +402,6 @@ public class PostmanCollectionCodegenTest {
|
||||
assertFileContains(path, "\\\"acceptHeader\\\" : \\\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\\\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeprecatedEndpoint() throws Exception {
|
||||
|
||||
File output = Files.createTempDirectory("postmantest_").toFile();
|
||||
output.deleteOnExit();
|
||||
|
||||
final CodegenConfigurator configurator = new CodegenConfigurator()
|
||||
.setGeneratorName("postman-collection")
|
||||
.setInputSpec("src/test/resources/3_0/postman-collection/SampleProject.yaml")
|
||||
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
|
||||
|
||||
DefaultGenerator generator = new DefaultGenerator();
|
||||
List<File> files = generator.opts(configurator.toClientOptInput()).generate();
|
||||
|
||||
System.out.println(files);
|
||||
files.forEach(File::deleteOnExit);
|
||||
|
||||
Path path = Paths.get(output + "/postman.json");
|
||||
assertFileExists(path);
|
||||
// verify request name (from path)
|
||||
assertFileContains(path, "(DEPRECATED)");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGeneratedVariables() throws Exception {
|
||||
|
||||
@@ -479,36 +456,6 @@ public class PostmanCollectionCodegenTest {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHeaderParameters() throws IOException {
|
||||
|
||||
File output = Files.createTempDirectory("postmantest_").toFile();
|
||||
output.deleteOnExit();
|
||||
|
||||
final CodegenConfigurator configurator = new CodegenConfigurator()
|
||||
.setGeneratorName("postman-collection")
|
||||
.setInputSpec("./src/test/resources/SampleProject.yaml")
|
||||
.setInputSpec("src/test/resources/3_0/postman-collection/SampleProject.yaml")
|
||||
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
|
||||
|
||||
final ClientOptInput clientOptInput = configurator.toClientOptInput();
|
||||
DefaultGenerator generator = new DefaultGenerator();
|
||||
List<File> files = generator.opts(clientOptInput).generate();
|
||||
|
||||
files.forEach(File::deleteOnExit);
|
||||
|
||||
Path path = Paths.get(output + "/postman.json");
|
||||
TestUtils.assertFileExists(path);
|
||||
TestUtils.assertFileContains(path, "{ \"key\": \"Content-Type\", \"value\": \"application/json\"");
|
||||
TestUtils.assertFileContains(path, "{ \"key\": \"Accept\", \"value\": \"application/json\"");
|
||||
// header without default value (disabled: true)
|
||||
TestUtils.assertFileContains(path, "{ \"key\": \"Custom-Header\", \"value\": \"\", \"description\": \"Custom HTTP header\", \"disabled\": true");
|
||||
// header with default value (disabled: false)
|
||||
TestUtils.assertFileContains(path, "{ \"key\": \"Another-Custom-Header\", \"value\": \"abc\", \"description\": \"Custom HTTP header with default\", \"disabled\": false");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testFormatDescription() {
|
||||
|
||||
@@ -755,27 +702,4 @@ public class PostmanCollectionCodegenTest {
|
||||
assertEquals(true, postmanV2Generator.codegenOperationsByTag.containsKey("default"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequiredQueryParameter() throws IOException {
|
||||
|
||||
File output = Files.createTempDirectory("postmantest_").toFile();
|
||||
output.deleteOnExit();
|
||||
|
||||
final CodegenConfigurator configurator = new CodegenConfigurator()
|
||||
.setGeneratorName("postman-collection")
|
||||
.setInputSpec("src/test/resources/3_0/postman-collection/SampleProject.yaml")
|
||||
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
|
||||
|
||||
DefaultGenerator generator = new DefaultGenerator();
|
||||
List<File> files = generator.opts(configurator.toClientOptInput()).generate();
|
||||
|
||||
System.out.println(files);
|
||||
files.forEach(File::deleteOnExit);
|
||||
|
||||
Path path = Paths.get(output + "/postman.json");
|
||||
TestUtils.assertFileExists(path);
|
||||
// verify param pUserId is set as disabled=false
|
||||
TestUtils.assertFileContains(path, "{ \"key\": \"pUserId\", \"value\": \"888\", \"description\": \"Query Id.\", \"disabled\": false");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user