-
Notifications
You must be signed in to change notification settings - Fork 786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add integrations tests to check malformed API contexts #13234
Conversation
Build is failed |
|
997670f
to
57522af
Compare
HttpResponse response = null; | ||
|
||
ArrayList<String> policies = new ArrayList<String>(); | ||
policies.add("Unlimited"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we use APIMIntegrationConstants.API_TIER.UNLIMITED?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed from a31b2d2
JSONObject additionalPropertiesObj = new JSONObject(); | ||
additionalPropertiesObj.put("name", "GraphQLAPIWithInvalidContext"); | ||
additionalPropertiesObj.put("context", "invalidContext{version}"); | ||
additionalPropertiesObj.put("version", API_VERSION_1_0_0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move the name, context, version words to constants.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed from a31b2d2
endpointConfig.put("production_endpoints", url); | ||
additionalPropertiesObj.put("endpointConfig", endpointConfig); | ||
additionalPropertiesObj.put("policies", policies); | ||
additionalPropertiesObj.put("operations", operations); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can move the property names to constants, as there are multiple usages in the class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed from a31b2d2
apiCreationRequestBean.setVersion(apiVersion); | ||
apiCreationRequestBean.setDescription(apiDescription); | ||
apiCreationRequestBean.setTags(apiTag); | ||
apiCreationRequestBean.setTier("Gold"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we use APIMIntegrationConstants.API_TIER.GOLD?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed from a31b2d2
|
||
HttpResponse response = restAPIPublisher.addAPIWithMalformedContext(apiCreationRequestBean); | ||
Assert.assertNotNull(response, "Response cannot be null"); | ||
Assert.assertEquals(response.getResponseCode(), 400, "Response Code miss matched when creating the API"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use Response.Status.NOT_FOUND.getStatusCode() for 400
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed from a31b2d2
apiRequest.setApiTier(APIMIntegrationConstants.API_TIER.UNLIMITED); | ||
|
||
HttpResponse response = restAPIPublisher.addAPIWithMalformedContext(apiRequest); | ||
Assert.assertEquals(response.getResponseCode(), 400, "Response Code miss matched when creating the API"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use Response.Status.NOT_FOUND.getStatusCode() for 400
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed from a31b2d2
This PR adds integration tests to cover the following scenarios.