From da48db517c86d46d491f67cd979670db82035c26 Mon Sep 17 00:00:00 2001 From: Okke Harsta Date: Mon, 27 Nov 2023 13:36:11 +0100 Subject: [PATCH] Test VOOT urns for migrated teams --- .../java/access/teams/TeamsControllerTest.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/server/src/test/java/access/teams/TeamsControllerTest.java b/server/src/test/java/access/teams/TeamsControllerTest.java index 14616a55..d1dbc948 100644 --- a/server/src/test/java/access/teams/TeamsControllerTest.java +++ b/server/src/test/java/access/teams/TeamsControllerTest.java @@ -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; @@ -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> 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 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