Skip to content

Commit

Permalink
Merge pull request #514 from ankitmashu/fix/response_fix
Browse files Browse the repository at this point in the history
Fix/response fix
  • Loading branch information
pranavrd authored May 22, 2024
2 parents 51d4c9c + f756da2 commit 7794e5d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
5 changes: 4 additions & 1 deletion docs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3428,14 +3428,17 @@ components:
type: string
title:
type: string
description:
type: string
results:
description: An array of objects
type: array
items:
type: object
example:
type: urn:dx:rs:success
title: Successfully changed the password
title: successful
detail: Successfully changed the password
results: [
{ "username": "asasdasd-asdasd-aada-d23342",
"apiKey": "asass8a7s"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package iudx.resource.server.databroker;

import static iudx.resource.server.databroker.util.Constants.BAD_REQUEST_CODE;
import static iudx.resource.server.databroker.util.Constants.BAD_REQUEST_DATA;
import static iudx.resource.server.databroker.util.Constants.ID;
import static iudx.resource.server.databroker.util.Constants.STATUS;
import static iudx.resource.server.databroker.util.Constants.TYPE;
import static iudx.resource.server.databroker.util.Constants.USER_ID;
import static iudx.resource.server.common.HttpStatusCode.SUCCESS;
import static iudx.resource.server.databroker.util.Constants.*;

import io.vertx.core.AsyncResult;
import io.vertx.core.Future;
Expand Down Expand Up @@ -116,6 +112,7 @@ public DataBrokerService getExchange(
}
return this;
}

/*
* overridden method
*/
Expand Down Expand Up @@ -838,7 +835,8 @@ public DataBrokerService resetPassword(
.onSuccess(
successHandler -> {
response.put("type", ResponseUrn.SUCCESS_URN.getUrn());
response.put("title", "Successfully changed the password");
response.put(TITLE, "successful");
response.put(DETAIL, "Successfully changed the password");
JsonArray result =
new JsonArray()
.add(new JsonObject().put("username", userid).put("apiKey", password));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ void ResetUserPwd() {
.post("/user/resetPassword")
.then()
.statusCode(200)
.body("title", equalTo("Successfully changed the password"))
.body("title", equalTo("successful"))
.body("detail", equalTo("Successfully changed the password"))
.extract()
.response();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ public void test_resetPassword_success(VertxTestContext vertxTestContext) {
String actual = object.getString("username");
assertEquals("Dummy User ID", actual);
assertEquals("urn:dx:rs:success", handler.result().getString("type"));
assertEquals("Successfully changed the password", handler.result().getString("title"));
assertEquals("successful", handler.result().getString("title"));
assertNotNull(handler.result().getString("result"));
vertxTestContext.completeNow();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22432,7 +22432,7 @@
"pm.test(\"Check response body\", function () { ",
" const body = pm.response.json();",
" pm.expect(body).to.have.property(\"type\", \"urn:dx:rs:success\");",
" pm.expect(body).to.have.property(\"title\", \"Successfully changed the password\");",
" pm.expect(body).to.have.property(\"title\", \"successful\");",
" pm.expect(body).to.have.property(\"result\");",
" const resultsjsonData = body.result[0];",
" pm.expect(resultsjsonData).to.have.property(\"username\");",
Expand Down

0 comments on commit 7794e5d

Please sign in to comment.