Skip to content

Commit

Permalink
Test VOOT urns for migrated teams
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Nov 27, 2023
1 parent adea65c commit da48db5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions server/src/test/java/access/teams/TeamsControllerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
import access.model.Application;
import access.model.User;
import com.fasterxml.jackson.core.JsonProcessingException;
import io.restassured.common.mapper.TypeRef;
import io.restassured.http.ContentType;
import org.junit.jupiter.api.Test;

import java.util.List;
import java.util.Map;

import static access.Seed.GUEST_SUB;
import static io.restassured.RestAssured.given;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down Expand Up @@ -71,6 +74,20 @@ void migrateTeam() throws JsonProcessingException {
assertEquals(2, users.size());
users.forEach(user -> assertEquals(team.getName(), user.getUserRoles().iterator().next().getRole().getName()));

//Now check if we get the correct URN from the Voot interface
List<Map<String, String>> groups = given()
.when()
.auth().basic("voot", "secret")
.accept(ContentType.JSON)
.contentType(ContentType.JSON)
.pathParam("sub", "urn:collab:person:surfnet.nl:hdoe")
.get("/api/voot/{sub}")
.as(new TypeRef<>() {
});
assertEquals(1, groups.size());
Map<String, String> group = groups.get(0);
assertEquals("urn:collab:group:test.surfteams.nl::nl:surfnet:diensten:test", group.get("urn"));
assertEquals(team.getName(), group.get("name"));
}

@Test
Expand Down

0 comments on commit da48db5

Please sign in to comment.