@@ -58,23 +58,14 @@ public void testSecurityWithoutGlobal() throws Exception {
58
58
gen .opts (clientOptInput );
59
59
Map <String , List <CodegenOperation >> paths = gen .processPaths (swagger .getPaths ());
60
60
61
- CodegenSecurity cs , apiKey , petstoreAuth ;
61
+ CodegenSecurity apiKey , petstoreAuth ;
62
62
63
- // security of "getPetById": api_key, petstore_auth
63
+ // security of "getPetById": api_key
64
64
CodegenOperation getPetById = findCodegenOperationByOperationId (paths , "getPetById" );
65
- assertEquals (getPetById .authMethods .size (), 2 );
66
- cs = getPetById .authMethods .get (0 );
67
- if ("api_key" .equals (cs .name )) {
68
- apiKey = cs ;
69
- petstoreAuth = getPetById .authMethods .get (1 );
70
- } else {
71
- petstoreAuth = cs ;
72
- apiKey = getPetById .authMethods .get (1 );
73
- }
65
+ assertEquals (getPetById .authMethods .size (), 1 );
66
+ apiKey = getPetById .authMethods .iterator ().next ();
74
67
assertEquals (apiKey .name , "api_key" );
75
68
assertEquals (apiKey .type , "apiKey" );
76
- assertEquals (petstoreAuth .name , "petstore_auth" );
77
- assertEquals (petstoreAuth .type , "oauth2" );
78
69
79
70
// security of "updatePetWithForm": petstore_auth
80
71
CodegenOperation updatePetWithForm = findCodegenOperationByOperationId (paths , "updatePetWithForm" );
@@ -99,23 +90,14 @@ public void testSecurityWithGlobal() throws Exception {
99
90
gen .opts (clientOptInput );
100
91
Map <String , List <CodegenOperation >> paths = gen .processPaths (swagger .getPaths ());
101
92
102
- CodegenSecurity cs , apiKey , petstoreAuth ;
93
+ CodegenSecurity apiKey , petstoreAuth ;
103
94
104
- // security of "getPetById": api_key, petstore_auth
95
+ // security of "getPetById": api_key
105
96
CodegenOperation getPetById = findCodegenOperationByOperationId (paths , "getPetById" );
106
- assertEquals (getPetById .authMethods .size (), 2 );
107
- cs = getPetById .authMethods .get (0 );
108
- if ("api_key" .equals (cs .name )) {
109
- apiKey = cs ;
110
- petstoreAuth = getPetById .authMethods .get (1 );
111
- } else {
112
- petstoreAuth = cs ;
113
- apiKey = getPetById .authMethods .get (1 );
114
- }
97
+ assertEquals (getPetById .authMethods .size (), 1 );
98
+ apiKey = getPetById .authMethods .iterator ().next ();
115
99
assertEquals (apiKey .name , "api_key" );
116
100
assertEquals (apiKey .type , "apiKey" );
117
- assertEquals (petstoreAuth .name , "petstore_auth" );
118
- assertEquals (petstoreAuth .type , "oauth2" );
119
101
120
102
// security of "updatePetWithForm": petstore_auth
121
103
CodegenOperation updatePetWithForm = findCodegenOperationByOperationId (paths , "updatePetWithForm" );
0 commit comments