Skip to content

Commit

Permalink
Coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Sep 6, 2024
1 parent 54c59ef commit 3caa76e
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 4 deletions.
8 changes: 5 additions & 3 deletions server/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ logging:
level:
root: WARN
com.zaxxer.hikari: ERROR
org.springframework.security: TRACE
org.mariadb.jdbc.message.server: ERROR
org.springframework.security: INFO
access: DEBUG
threshold:
console: WARN
Expand Down Expand Up @@ -173,7 +174,7 @@ manage:
user: invite
password: secret
# If manage is disabled (e.g. enabled: False) the staticManageDirectory is the directory where the {metadata_type}.json files

Check warning on line 176 in server/src/main/resources/application.yml

View workflow job for this annotation

GitHub Actions / Test documentation and generate openapi html documentation

176:1 [comments-indentation] comment not indented like content
# are located. This can also be an absolute file path, e.g. file:///opt/openconext/oidc-playground/manage
# are located. This can also be an absolute file path, e.g. file:///opt/openconext/invite/manage
staticManageDirectory: classpath:/manage
# staticManageDirectory: file:///usr/local/etc/manage

Expand Down Expand Up @@ -203,10 +204,11 @@ management:
enabled: true
health:
enabled: true
show-details: always
mappings:
enabled: true
metrics:
enabled: true
enabled: false
info:
git:
mode: full
Expand Down
3 changes: 2 additions & 1 deletion server/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
</Pattern>
</layout> </appender>
<logger name="access" level="DEBUG"/>
<logger name="org.springframework.security" level="TRACE"/>
<logger name="org.springframework.security" level="INFO"/>
<logger name="org.mariadb.jdbc.message.server" level="ERROR"/>
<logger name="com.zaxxer.hikari" level="ERROR"/>
<root level="WARN">
<appender-ref ref="CONSOLE"/>
Expand Down
Binary file added server/src/main/resources/public/favicon.ico
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ void getGroupMemberships() throws JsonProcessingException {
assertTrue(roles.get(0).get("id").startsWith("urn:mace:surf.nl:test.surfaccess.nl:"));
}

@Test
void getGroupMembershipsManageUnavailable() {
List<Map<String, String>> roles = given()
.when()
.auth().preemptive().basic("aa", "secret")
.accept(ContentType.JSON)
.contentType(ContentType.JSON)
.pathParam("sub", GUEST_SUB)
.queryParam("SPentityID", "")
.get("/api/external/v1/aa/{sub}")
.as(new TypeRef<>() {
});
assertEquals(0, roles.size());
}

@Test
void getGroupMembershipsGuestIncluded() throws JsonProcessingException {
stubForManageProviderByEntityID(EntityType.SAML20_SP, "https://wiki");
Expand Down
27 changes: 27 additions & 0 deletions server/src/test/java/access/teams/TeamsControllerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,31 @@ void migrateTeamInvalidSchacHome() {
});
assertEquals("SchacHomeOrganization of a person is required", responseBody.get("message"));
}

@Test
void migrateTeamManageUnavailable() {
List<Membership> memberships = getMemberships();
List<Application> applications = List.of(
new Application("1", EntityType.SAML20_SP),
new Application("5", EntityType.OIDC10_RP));
Team team = new Team(
"nl:surfnet:diensten:test",
"test migration",
"test migration",
memberships,
applications
);

given()
.when()
.auth().preemptive().basic("teams", "secret")
.accept(ContentType.JSON)
.contentType(ContentType.JSON)
.body(team)
.put("/api/external/v1/teams")
.then()
.statusCode(400);

}

}

0 comments on commit 3caa76e

Please sign in to comment.