forked from loafle/openapi-generator-original
Correct import, add test (#13905)
This commit is contained in:
parent
9f1fa0e440
commit
7a17d3dc55
@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"testing"
|
"testing"
|
||||||
{{goImportAlias}} "./openapi"
|
{{goImportAlias}} "{{gitHost}}/{{gitUserId}}/{{gitRepoId}}{{#isGoSubmodule}}/{{packageName}}{{/isGoSubmodule}}"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_{{packageName}}_{{classname}}Service(t *testing.T) {
|
func Test_{{packageName}}_{{classname}}Service(t *testing.T) {
|
||||||
|
@ -222,6 +222,27 @@ public class GoClientCodegenTest {
|
|||||||
"func Test_openapi_PetApiService(t *testing.T) {");
|
"func Test_openapi_PetApiService(t *testing.T) {");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void verifyTestImport() throws IOException {
|
||||||
|
File output = Files.createTempDirectory("test").toFile();
|
||||||
|
output.deleteOnExit();
|
||||||
|
|
||||||
|
final CodegenConfigurator configurator = new CodegenConfigurator()
|
||||||
|
.setGeneratorName("go")
|
||||||
|
.setGitUserId("OpenAPITools")
|
||||||
|
.setGitRepoId("openapi-generator")
|
||||||
|
.setInputSpec("src/test/resources/3_0/petstore.yaml")
|
||||||
|
.setOutputDir(output.getAbsolutePath().replace("\\", "/"));
|
||||||
|
|
||||||
|
DefaultGenerator generator = new DefaultGenerator();
|
||||||
|
List<File> files = generator.opts(configurator.toClientOptInput()).generate();
|
||||||
|
files.forEach(File::deleteOnExit);
|
||||||
|
|
||||||
|
TestUtils.assertFileExists(Paths.get(output + "/test/api_pet_test.go"));
|
||||||
|
TestUtils.assertFileContains(Paths.get(output + "/test/api_pet_test.go"),
|
||||||
|
"openapiclient \"github.com/OpenAPITools/openapi-generator\"");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void verifyFormatErrorMessageInUse() throws IOException {
|
public void verifyFormatErrorMessageInUse() throws IOException {
|
||||||
File output = Files.createTempDirectory("test").toFile();
|
File output = Files.createTempDirectory("test").toFile();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user