mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-03-06 04:10:52 +01:00
Fix integration test
This commit is contained in:
@@ -3,12 +3,14 @@ package sonia.scm.it;
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import sonia.scm.it.utils.RestUtil;
|
||||
import sonia.scm.it.utils.ScmRequests;
|
||||
import sonia.scm.it.utils.TestData;
|
||||
import sonia.scm.web.VndMediaType;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static sonia.scm.it.PermissionsITCase.USER_PASS;
|
||||
import static sonia.scm.it.utils.RestUtil.ADMIN_PASSWORD;
|
||||
import static sonia.scm.it.utils.RestUtil.ADMIN_USERNAME;
|
||||
import static sonia.scm.it.utils.RestUtil.given;
|
||||
import static sonia.scm.it.utils.TestData.USER_SCM_ADMIN;
|
||||
import static sonia.scm.it.utils.TestData.callRepository;
|
||||
@@ -28,9 +30,13 @@ public class RoleITCase {
|
||||
public void userShouldSeePermissionsAfterAddingRoleToUser() {
|
||||
callRepository(USER, USER_PASS, "git", HttpStatus.SC_FORBIDDEN);
|
||||
|
||||
String repositoryRolesUrl = new ScmRequests()
|
||||
.requestIndexResource(ADMIN_USERNAME, ADMIN_PASSWORD)
|
||||
.getUrl("repositoryRoles");
|
||||
|
||||
given()
|
||||
.when()
|
||||
.delete(RestUtil.createResourceUrl("repository-roles/" + ROLE_NAME))
|
||||
.delete(repositoryRolesUrl + ROLE_NAME)
|
||||
.then()
|
||||
.statusCode(HttpStatus.SC_NO_CONTENT);
|
||||
|
||||
@@ -40,7 +46,7 @@ public class RoleITCase {
|
||||
"\"name\": \"" + ROLE_NAME + "\"," +
|
||||
"\"verbs\": [\"read\",\"permissionRead\"]" +
|
||||
"}")
|
||||
.post(RestUtil.createResourceUrl("repository-roles/"))
|
||||
.post(repositoryRolesUrl)
|
||||
.then()
|
||||
.statusCode(HttpStatus.SC_CREATED);
|
||||
|
||||
|
||||
@@ -201,7 +201,12 @@ public class ScmRequests {
|
||||
return super.assertPropertyPathDoesNotExists(LINK_USERS);
|
||||
}
|
||||
|
||||
|
||||
public String getUrl(String linkName) {
|
||||
return response
|
||||
.then()
|
||||
.extract()
|
||||
.path("_links." + linkName + ".href");
|
||||
}
|
||||
}
|
||||
|
||||
public class RepositoryResponse<PREV extends ModelResponse> extends ModelResponse<RepositoryResponse<PREV>, PREV> {
|
||||
|
||||
Reference in New Issue
Block a user