use of org.eclipse.vorto.repository.web.account.dto.UserDto in project vorto by eclipse.
the class AccountControllerTest method verifyTechnicalUserCreatedBy.
@Test
public void verifyTechnicalUserCreatedBy() throws Exception {
UserDto payload = UserDto.fromUser(new UserBuilder().withName("theTechnicalUser").withAuthenticationProviderID("GITHUB").withAuthenticationSubject("theSubject").build());
repositoryServer.perform(post("/rest/accounts/createTechnicalUser").content(objectMapper.writeValueAsString(payload)).contentType("application/json").with(userSysadmin)).andExpect(status().isCreated());
// fetch sysadmin id
User sysadmin = userRepository.findByUsername(USER_SYSADMIN_NAME);
assertNotNull(sysadmin);
// compare with the tech user created by
User theTechnicalUser = userRepository.findByUsername("theTechnicalUser");
assertNotNull(theTechnicalUser);
assertEquals(sysadmin.getId(), theTechnicalUser.getCreatedBy());
}
Aggregations