refactored backend tests to generate profileImageUrl in BaseTest with origin http://localhost:8080 and without default filename (#21)

This commit is contained in:
Art
2021-09-20 18:45:10 +03:00
parent a2c1ab8567
commit 9d881a840f
2 changed files with 2 additions and 3 deletions

View File

@ -13,7 +13,6 @@ import java.time.LocalDateTime;
import java.util.UUID;
import static net.shyshkin.study.fullstack.supportportal.backend.constant.FileConstant.DEFAULT_USER_IMAGE_PATH;
import static net.shyshkin.study.fullstack.supportportal.backend.constant.FileConstant.USER_IMAGE_FILENAME;
import static net.shyshkin.study.fullstack.supportportal.backend.domain.Role.ROLE_ADMIN;
@SpringBootTest
@ -64,7 +63,7 @@ public abstract class BaseUserTest {
.fromUriString("http://localhost:8080")
.path(DEFAULT_USER_IMAGE_PATH)
.pathSegment(userId)
.pathSegment(USER_IMAGE_FILENAME)
// .pathSegment(USER_IMAGE_FILENAME)
.toUriString();
}
}

View File

@ -216,7 +216,7 @@ class UserResourceTest extends BaseUserTest {
.hasFieldOrPropertyWithValue("isActive", true)
.hasFieldOrPropertyWithValue("isNotLocked", true)
.hasFieldOrPropertyWithValue("role", "ROLE_ADMIN")
.satisfies(u -> assertThat(u.getProfileImageUrl()).endsWith(String.format("/user/image/profile/%s/avatar.jpg", u.getUserId())));
.satisfies(u -> assertThat(u.getProfileImageUrl()).endsWith(String.format("/user/image/profile/%s", u.getUserId())));
String token = responseEntity.getHeaders().getFirst(JWT_TOKEN_HEADER);
log.debug("Token: {}", token);