|
25 | 25 | import io.swagger.v3.parser.core.models.ParseOptions; |
26 | 26 | import io.swagger.v3.parser.util.SchemaTypeUtil; |
27 | 27 | import org.openapitools.codegen.*; |
| 28 | +import org.openapitools.codegen.config.CodegenConfigurator; |
28 | 29 | import org.openapitools.codegen.languages.PythonClientCodegen; |
29 | 30 | import org.openapitools.codegen.languages.features.CXFServerFeatures; |
30 | 31 | import org.testng.Assert; |
@@ -611,4 +612,26 @@ public void testInitFileImportsExports() throws IOException { |
611 | 612 | assertFileContains(initFilePath, "from openapi_client.models.tag import Tag as Tag"); |
612 | 613 | assertFileContains(initFilePath, "from openapi_client.models.user import User as User"); |
613 | 614 | } |
| 615 | + |
| 616 | + @Test(description = "tests NoProxyPyClient") |
| 617 | + public void testNoProxyPyClient() throws Exception { |
| 618 | + |
| 619 | + final String gen = "python"; |
| 620 | + final String spec = "src/test/resources/3_0/petstore.yaml"; |
| 621 | + |
| 622 | + File output = Files.createTempDirectory("test").toFile(); |
| 623 | + final CodegenConfigurator configurator = new CodegenConfigurator() |
| 624 | + .setGeneratorName(gen) |
| 625 | + .setInputSpec(spec) |
| 626 | + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); |
| 627 | + final ClientOptInput clientOptInput = configurator.toClientOptInput(); |
| 628 | + DefaultGenerator generator = new DefaultGenerator(); |
| 629 | + List<File> files = generator.opts(clientOptInput).generate(); |
| 630 | + |
| 631 | + for (String f : new String[] { "openapi_client/configuration.py", "openapi_client/rest.py" } ) { |
| 632 | + TestUtils.ensureContainsFile(files, output, f); |
| 633 | + Path p = output.toPath().resolve(f); |
| 634 | + TestUtils.assertFileContains(p, "no_proxy"); |
| 635 | + } |
| 636 | + } |
614 | 637 | } |
0 commit comments