Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Sep 26, 2023
1 parent 87435a0 commit 70ec47e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions server/src/main/java/access/model/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
@NoArgsConstructor
@Getter
@Setter
@SuppressWarnings("unchecked")
public class User implements Serializable, Provisionable {

@Id
Expand Down Expand Up @@ -89,7 +90,7 @@ public User(boolean superUser, Map<String, Object> attributes) {
this.email = (String) attributes.get("email");
this.givenName = (String) attributes.get("given_name");
this.familyName = (String) attributes.get("family_name");
this.institutionAdmin = (boolean) attributes.get(INSTITUTION_ADMIN);
this.institutionAdmin = (boolean) attributes.getOrDefault(INSTITUTION_ADMIN, false);
this.organizationGUID = (String) attributes.get(ORGANIZATION_GUID);
this.applications = (List<Map<String, Object>>) attributes.getOrDefault(APPLICATIONS, Collections.emptyList());
this.createdAt = Instant.now();
Expand Down Expand Up @@ -175,7 +176,7 @@ public void updateAttributes(Map<String, Object> attributes) {
this.givenName = (String) attributes.get("given_name");
this.familyName = (String) attributes.get("family_name");
this.email = (String) attributes.get("email");
this.institutionAdmin = (boolean) attributes.get(INSTITUTION_ADMIN);
this.institutionAdmin = (boolean) attributes.getOrDefault(INSTITUTION_ADMIN, false);
this.organizationGUID = (String) attributes.get(ORGANIZATION_GUID);
this.applications = (List<Map<String, Object>>) attributes.getOrDefault(APPLICATIONS, Collections.emptyList());
this.lastActivity = Instant.now();
Expand Down
3 changes: 2 additions & 1 deletion server/src/test/java/access/api/UserControllerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ void meWithOauth2Login() throws Exception {

@Test
void institutionAdminProvision() throws Exception {
super.stubForManageProviderByOrganisationGUID(ORGANISATION_GUID);

AccessCookieFilter accessCookieFilter = openIDConnectFlow("/api/v1/users/me", "new_institution_admin",
s -> {
}, m -> {
Expand All @@ -102,7 +104,6 @@ void institutionAdminProvision() throws Exception {
));
return m;
});
super.stubForManageProviderByOrganisationGUID(ORGANISATION_GUID);

User user = given()
.when()
Expand Down

0 comments on commit 70ec47e

Please sign in to comment.