Skip to content

Commit

Permalink
Merge pull request #19815 from wso2/revert-19814-version-bump
Browse files Browse the repository at this point in the history
Revert "Modify test case"
  • Loading branch information
DMHP authored Feb 23, 2024
2 parents 959e145 + fcbfbee commit c07775c
Showing 1 changed file with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,30 +243,30 @@ public void testCreateUserWithCharsetEncodingHeader() throws Exception {

@Test
public void testAddUserFailure() throws Exception {
HttpPost request = new HttpPost(getPath());
request.addHeader(HttpHeaders.AUTHORIZATION, getAuthzHeader());
request.addHeader(HttpHeaders.CONTENT_TYPE, "application/json");

JSONObject rootObject = new JSONObject();

JSONArray schemas = new JSONArray();
rootObject.put(SCHEMAS_ATTRIBUTE, schemas);

JSONObject names = new JSONObject();
rootObject.put(NAME_ATTRIBUTE, names);
rootObject.put(USER_NAME_ATTRIBUTE, "passwordIncompatibleUser");
rootObject.put(PASSWORD_ATTRIBUTE, "a");

StringEntity entity = new StringEntity(rootObject.toString());
request.setEntity(entity);

HttpResponse response = client.execute(request);

Object responseObj = JSONValue.parse(EntityUtils.toString(response.getEntity()));
EntityUtils.consume(response.getEntity());

LOG.info("Response of testAddUserFailure method:" + responseObj.toString());

// HttpPost request = new HttpPost(getPath());
// request.addHeader(HttpHeaders.AUTHORIZATION, getAuthzHeader());
// request.addHeader(HttpHeaders.CONTENT_TYPE, "application/json");
//
// JSONObject rootObject = new JSONObject();
//
// JSONArray schemas = new JSONArray();
// rootObject.put(SCHEMAS_ATTRIBUTE, schemas);
//
// JSONObject names = new JSONObject();
// rootObject.put(NAME_ATTRIBUTE, names);
// rootObject.put(USER_NAME_ATTRIBUTE, "passwordIncompatibleUser");
// rootObject.put(PASSWORD_ATTRIBUTE, "a");
//
// StringEntity entity = new StringEntity(rootObject.toString());
// request.setEntity(entity);
//
// HttpResponse response = client.execute(request);
//
// Object responseObj = JSONValue.parse(EntityUtils.toString(response.getEntity()));
// EntityUtils.consume(response.getEntity());
//
// LOG.info("Response of testAddUserFailure method:" + responseObj.toString());
//
// JSONArray schemasArray = (JSONArray)((JSONObject) responseObj).get("schemas");
// Assert.assertNotNull(schemasArray);
// Assert.assertEquals(schemasArray.size(), 1);
Expand Down

0 comments on commit c07775c

Please sign in to comment.