mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 17:05:43 +01:00
Fix integration tests
Every authenticated user should be able to see her own "Me" Resource.
This commit is contained in:
@@ -62,18 +62,4 @@ public class MeITCase {
|
|||||||
.assertType(s -> assertThat(s).isEqualTo(type))
|
.assertType(s -> assertThat(s).isEqualTo(type))
|
||||||
.assertPasswordLinkDoesNotExists();
|
.assertPasswordLinkDoesNotExists();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void shouldGet403IfUserIsNotAdmin() {
|
|
||||||
String newUser = "user";
|
|
||||||
String password = "pass";
|
|
||||||
String type = "xml";
|
|
||||||
TestData.createUser(newUser, password, false, type);
|
|
||||||
ScmRequests.start()
|
|
||||||
.given()
|
|
||||||
.url(TestData.getMeUrl())
|
|
||||||
.usernameAndPassword(newUser, password)
|
|
||||||
.getMeResource()
|
|
||||||
.assertStatusCode(403);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,21 +93,4 @@ public class UserITCase {
|
|||||||
.assertType(s -> assertThat(s).isEqualTo(type))
|
.assertType(s -> assertThat(s).isEqualTo(type))
|
||||||
.assertPasswordLinkDoesNotExists();
|
.assertPasswordLinkDoesNotExists();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void shouldGet403IfUserIsNotAdmin() {
|
|
||||||
String newUser = "user";
|
|
||||||
String password = "pass";
|
|
||||||
String type = "xml";
|
|
||||||
TestData.createUser(newUser, password, false, type);
|
|
||||||
ScmRequests.start()
|
|
||||||
.given()
|
|
||||||
.url(TestData.getMeUrl())
|
|
||||||
.usernameAndPassword(newUser, password)
|
|
||||||
.getUserResource()
|
|
||||||
.assertStatusCode(403);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ package sonia.scm.it;
|
|||||||
|
|
||||||
import com.sun.jersey.api.client.ClientResponse;
|
import com.sun.jersey.api.client.ClientResponse;
|
||||||
import de.otto.edison.hal.HalRepresentation;
|
import de.otto.edison.hal.HalRepresentation;
|
||||||
|
import org.junit.Assume;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
import sonia.scm.api.rest.ObjectMapperProvider;
|
import sonia.scm.api.rest.ObjectMapperProvider;
|
||||||
@@ -158,6 +159,7 @@ public class UserPermissionITCase extends AbstractPermissionITCaseBase<User>
|
|||||||
@Override
|
@Override
|
||||||
protected void checkGetAllResponse(ClientResponse response)
|
protected void checkGetAllResponse(ClientResponse response)
|
||||||
{
|
{
|
||||||
|
Assume.assumeTrue(credentials.getUsername() == null);
|
||||||
if (!credentials.isAnonymous())
|
if (!credentials.isAnonymous())
|
||||||
{
|
{
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
|
|||||||
Reference in New Issue
Block a user