Skip to content

Commit a97c74d

Browse files
committed
tests for Oauth2 controller
1 parent 7e6bd5b commit a97c74d

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

server/src/test/java/dev/findfirst/users/controller/UserControllerTest.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
@IntegrationTest
5151
@MockTypesense
5252
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
53-
@TestPropertySource(locations = "classpath:application-test.yml", properties = {
54-
"spring.security.oauth2.client.registration.github.client-secret=secret-oauth",
55-
"spring.security.oauth2.client.registration.github.client-id=test-id" })
53+
@TestPropertySource(locations = "classpath:application-test.yml",
54+
properties = {"spring.security.oauth2.client.registration.github.client-secret=secret-oauth",
55+
"spring.security.oauth2.client.registration.github.client-id=test-id"})
5656
class UserControllerTest {
5757

5858
TestRestTemplate restTemplate = new TestRestTemplate();
@@ -73,8 +73,8 @@ class UserControllerTest {
7373
static PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>("postgres:16.2-alpine3.19");
7474

7575
@Container
76-
public static GenericContainer<?> mailhog = new GenericContainer<>(DockerImageName.parse("mailhog/mailhog:latest"))
77-
.withExposedPorts(1025,
76+
public static GenericContainer<?> mailhog =
77+
new GenericContainer<>(DockerImageName.parse("mailhog/mailhog:latest")).withExposedPorts(1025,
7878
8025);
7979

8080
@TestConfiguration
@@ -100,8 +100,7 @@ public JavaMailSender javaMailSender() {
100100
private String userUrl = "/user";
101101

102102
/**
103-
* Tests that a user should be able to sign up. After signing up another user
104-
* should not be able
103+
* Tests that a user should be able to sign up. After signing up another user should not be able
105104
* use the same username or email.
106105
*/
107106
@Test
@@ -118,8 +117,7 @@ void userSignup() {
118117
}
119118

120119
/**
121-
* Create a user, gets the registration token from the email. Uses the token to
122-
* complete
120+
* Create a user, gets the registration token from the email. Uses the token to complete
123121
* registration.
124122
*/
125123
@Test
@@ -250,8 +248,8 @@ void testRemoveUserPhoto_Success() throws Exception {
250248
void getAllProivders() {
251249
var response = restTemplate.getForEntity("/user/oauth2Providers", Oauth2Source[].class);
252250

253-
assertArrayEquals(new Oauth2Source[] { new Oauth2Source("GitHub", "https://github.com/favicon.ico") },
254-
response.getBody());
251+
assertArrayEquals(new Oauth2Source[] {new Oauth2Source("GitHub",
252+
"https://github.com/favicon.ico", "oauth2/authorization/github")}, response.getBody());
255253

256254
}
257255
}

0 commit comments

Comments
 (0)