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

Fix integration tests for improved user export API #16839

Merged
merged 2 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,10 @@ public class UserInfoExportTestCase extends ISIntegrationTest {
private static final String PI_INFO = "pi-info/";
private static final String ME = "me";
private static final String RESOURCE_PATH = "/api/identity/user/v1.0/";
private static final String USERNAME_CLAIM_URI = "http://wso2.org/claims/username";
private static final String GROUPS_ATTRIBUTE = "groups";
private HttpClient client;

private String username;
private String tenantAwareUsername;
private String password;
private String tenant;

Expand All @@ -64,7 +63,6 @@ public UserInfoExportTestCase(TestUserMode userMode) throws Exception {

AutomationContext context = new AutomationContext("IDENTITY", userMode);
this.username = context.getContextTenant().getTenantAdmin().getUserName();
this.tenantAwareUsername = context.getContextTenant().getTenantAdmin().getUserNameWithoutDomain();
this.password = context.getContextTenant().getTenantAdmin().getPassword();
this.tenant = context.getContextTenant().getDomain();
}
Expand Down Expand Up @@ -97,14 +95,13 @@ public void testExportUserInfo() throws IOException {

Object responseObj = JSONValue.parse(rd);
EntityUtils.consume(response.getEntity());
Object basicObj = ((JSONObject) responseObj).get("basic");
if (basicObj == null) {
Object userProfileObj = ((JSONObject) responseObj).get("user_profile");
if (userProfileObj == null) {
Assert.fail();
} else {
JSONObject basic = (JSONObject) basicObj;
String username = basic.get(USERNAME_CLAIM_URI).toString();
//TODO tenant aware username is coming. is this okay?
Assert.assertEquals(username, this.tenantAwareUsername);
hwupathum marked this conversation as resolved.
Show resolved Hide resolved
JSONObject userProfile = (JSONObject) userProfileObj;
String groups = userProfile.get(GROUPS_ATTRIBUTE).toString();
Assert.assertNotNull(groups);
}
}

Expand All @@ -121,10 +118,9 @@ public void testExportUserInfoMe() throws IOException {

Object responseObj = JSONValue.parse(rd);
EntityUtils.consume(response.getEntity());
JSONObject basic = (JSONObject)((JSONObject) responseObj).get("basic");
String username = basic.get(USERNAME_CLAIM_URI).toString();
//TODO tenant aware username is coming. is this okay?
Assert.assertEquals(username, this.tenantAwareUsername);
JSONObject userProfile = (JSONObject)((JSONObject) responseObj).get("user_profile");
String groups = userProfile.get(GROUPS_ATTRIBUTE).toString();
Assert.assertNotNull(groups);
}

private String getPiInfoPath() {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2292,7 +2292,7 @@
<properties>

<!--Carbon Identity Framework Version-->
<carbon.identity.framework.version>5.25.356</carbon.identity.framework.version>
<carbon.identity.framework.version>5.25.361</carbon.identity.framework.version>
<carbon.identity.framework.version.range>[5.14.67, 6.0.0]</carbon.identity.framework.version.range>

<!--SAML Common Utils Version-->
Expand Down