use of se.inera.intyg.webcert.web.auth.fake.FakeCredentials in project webcert by sklintyg.
the class CommonFakeAuthenticationProvider method overrideSekretessMarkeringFromFakeCredentials.
private void overrideSekretessMarkeringFromFakeCredentials(Authentication token, Object details) {
if (details instanceof IntygUser) {
IntygUser user = (IntygUser) details;
final FakeCredentials fakeCredentials = (FakeCredentials) token.getCredentials();
// Only override if set
if (fakeCredentials.getSekretessMarkerad() != null) {
user.setSekretessMarkerad(fakeCredentials.getSekretessMarkerad());
}
}
}
use of se.inera.intyg.webcert.web.auth.fake.FakeCredentials in project webcert by sklintyg.
the class UserApiControllerIT method testAndraValdEnhet.
@Test
public void testAndraValdEnhet() {
// Log in as user having medarbetaruppdrag at several vardenheter.
FakeCredentials user = new FakeCredentials.FakeCredentialsBuilder("IFV1239877878-104B", "IFV1239877878-1042").legitimeradeYrkesgrupper(asList("Läkare")).build();
RestAssured.sessionId = getAuthSession(user);
// An improvement of this would be to call hsaStub rest api to add testa data as we want it to
// avoid "magic" ids and the dependency to bootstrapped data?
final String vardEnhetToChangeTo = "IFV1239877878-1045";
ChangeSelectedUnitRequest changeRequest = new ChangeSelectedUnitRequest();
changeRequest.setId(vardEnhetToChangeTo);
given().cookie("ROUTEID", BaseRestIntegrationTest.routeId).contentType(ContentType.JSON).and().body(changeRequest).when().post("api/anvandare/andraenhet").then().statusCode(200).body(matchesJsonSchemaInClasspath("jsonschema/webcert-user-response-schema.json")).body("valdVardenhet.id", equalTo(vardEnhetToChangeTo));
}
Aggregations