Skip to content
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

DTSRD-2139.Update Organisation user idam id endpoint #1562

Open
wants to merge 28 commits into
base: master
Choose a base branch
from

Conversation

SabinaHMCTS
Copy link
Contributor

Jira link (if applicable)

Change description

Checklist

  • commit messages are meaningful and follow good commit message guidelines
  • README and other documentation has been updated / added (if needed)
  • tests have been updated / new tests has been added (if needed)
  • Does this PR introduce a breaking change


NewUserCreationRequest newUserCreationRequest =
professionalApiClient.createNewUserRequest("[email protected]");
Map<String, Object> newUserResponse = professionalApiClient.addNewUserToAnOrganisation(orgIdentifier,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont need to add new user to update idam id for existing user

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

creating a new user as test user to use as existing user for updating id

professionalApiClient.deleteOrganisation(orgIdentifier, hmctsAdmin, NO_CONTENT);

assertThat(updatedIdamResponse).isNotNull();
assertThat(professionalUsersResponse).isNotNull();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add assertion to verify that the user's idam id is updated with new id value

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

List<Map<String, Object>> professionalUsersResponses = (List<Map<String, Object>>) searchResponse.get("users");
Map professionalUsersResponse = getUserById(professionalUsersResponses, existingUserId);

professionalApiClient.deleteOrganisation(orgIdentifier, hmctsAdmin, NO_CONTENT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this line to after assertions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

updateOrganisation(organisationIdentifier, hmctsAdmin, ACTIVE);

//create new user
List<String> userRoles = new ArrayList<>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont need to add new user

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

creating test user



//validate overall response should be 200 always
assertThat(modifiedUserResponse.get("http_status")).isNotNull();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add assertion to verify that the user's idam id is updated with new id value

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not fetching id in response


@Operation(
summary = "Updates idam id for a user in an organisation",
description = "**IDAM Roles to access API** :<br> pui-organisation-manager",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change role name to prd-admin

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Response userResponse = userProfileFeignClient
.modifyUserRoles(userProfileUpdatedData, existingUserIdentifier," ");

Optional<ProfessionalUser> professionalUser = Optional
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update in PRD only when user profile update is success

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

assertThat(modifiedUserResponse.get("http_status")).isNotNull();
assertThat(modifiedUserResponse).containsEntry("http_status","400");
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add error scenario test cases for below user profile calls:

  1. userProfileFeignClient.getUserProfileById
  2. userProfileFeignClient.modifyUserRoles. (change this method name as its confusing)

Copy link
Contributor Author

@SabinaHMCTS SabinaHMCTS Jul 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added error testcase


assertThat(modifiedUserResponse.get("http_status")).isNotNull();
assertThat(modifiedUserResponse).containsEntry("http_status","400");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add test case for error scenario: "Request is empty"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@hmcts-jenkins-j-to-z
Copy link
Contributor

Plan Result (aat)

Plan: 0 to add, 1 to change, 0 to destroy.
  • Update
    • azurerm_resource_group.rg
Change Result (Click me)
  # azurerm_resource_group.rg will be updated in-place
  ~ resource "azurerm_resource_group" "rg" {
        id         = "/subscriptions/1c4f0704-a29e-403d-b719-b90c34ef14c9/resourceGroups/rd-professional-api-aat"
        name       = "rd-professional-api-aat"
      ~ tags       = {
          - "Deployment Environment" = "aat"
          - "Team Name"              = "RD"
          - "lastUpdated"            = "2024-07-17T09:07:18Z"
        } -> (known after apply)
        # (2 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

@hmcts-jenkins-j-to-z
Copy link
Contributor

Plan Result (prod)

Plan: 0 to add, 1 to change, 0 to destroy.
  • Update
    • azurerm_resource_group.rg
Change Result (Click me)
  # azurerm_resource_group.rg will be updated in-place
  ~ resource "azurerm_resource_group" "rg" {
        id         = "/subscriptions/8999dec3-0104-4a27-94ee-6588559729d1/resourceGroups/rd-professional-api-prod"
        name       = "rd-professional-api-prod"
      ~ tags       = {
          - "Deployment Environment" = "prod"
          - "Team Name"              = "RD"
          - "lastUpdated"            = "2024-07-17T09:18:35Z"
        } -> (known after apply)
        # (2 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants