File tree Expand file tree Collapse file tree 2 files changed +409
-0
lines changed
modules/swagger-codegen/src/test
java/io/swagger/codegen/v3/service Expand file tree Collapse file tree 2 files changed +409
-0
lines changed Original file line number Diff line number Diff line change 18
18
19
19
public class GeneratorServiceTest {
20
20
21
+ @ Test (description = "test generator service with html2" )
22
+ public void testGeneratorService_HTML2_Bearer () throws IOException {
23
+
24
+ String path = getTmpFolder ().getAbsolutePath ();
25
+ GenerationRequest request = new GenerationRequest ();
26
+ request
27
+ .codegenVersion (GenerationRequest .CodegenVersion .V3 )
28
+ .type (GenerationRequest .Type .CLIENT )
29
+ .lang ("html2" )
30
+ .spec (loadSpecAsNode ("3_0_0/html2BearerAuthIssue.yaml" , true , false ))
31
+ .options (
32
+ new Options ()
33
+ .outputDir (path )
34
+ );
35
+ List <File > files = new GeneratorService ().generationRequest (request ).generate ();
36
+ Assert .assertFalse (files .isEmpty ());
37
+ for (File f : files ) {
38
+ String relPath = f .getAbsolutePath ().substring (path .length ());
39
+ if ("/index.html" .equals (relPath )) {
40
+ //api key
41
+ Assert .assertTrue (FileUtils .readFileToString (f ).contains ("curl -X GET\\ \n " +
42
+ "-H \" api_key: [[apiKey]]\" \\ " ));
43
+ //basic
44
+ Assert .assertTrue (FileUtils .readFileToString (f ).contains ("curl -X POST\\ \n " +
45
+ " -H \" Authorization: Basic [[basicHash]]\" \\ " ));
46
+ //bearer
47
+ Assert .assertTrue (FileUtils .readFileToString (f ).contains ("curl -X PUT\\ \n " +
48
+ " -H \" Authorization: Bearer [[accessToken]]\" \\ " ));
49
+ }
50
+ }
51
+
52
+ }
53
+
21
54
@ Test (description = "test generator service with html2" )
22
55
public void testGeneratorService_HTML2 () throws IOException {
23
56
You can’t perform that action at this time.
0 commit comments