1717import dev .findfirst .security .userauth .models .TokenRefreshResponse ;
1818import dev .findfirst .security .userauth .models .payload .request .SignupRequest ;
1919import dev .findfirst .users .model .MailHogMessage ;
20+ import dev .findfirst .users .model .oauth2 .Oauth2Source ;
2021import dev .findfirst .users .model .user .TokenPassword ;
2122
2223import com .fasterxml .jackson .databind .ObjectMapper ;
4950@ IntegrationTest
5051@ MockTypesense
5152@ SpringBootTest (webEnvironment = SpringBootTest .WebEnvironment .RANDOM_PORT )
52- @ TestPropertySource (locations = "classpath:application-test.yml" ,
53- properties = { "spring.security.oauth2.client.registration.github.client-secret=secret-oauth" ,
54- "spring.security.oauth2.client.registration.github.client-id=test-id" })
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" })
5556class UserControllerTest {
5657
5758 TestRestTemplate restTemplate = new TestRestTemplate ();
@@ -72,8 +73,8 @@ class UserControllerTest {
7273 static PostgreSQLContainer <?> postgres = new PostgreSQLContainer <>("postgres:16.2-alpine3.19" );
7374
7475 @ Container
75- public static GenericContainer <?> mailhog =
76- new GenericContainer <>( DockerImageName . parse ( "mailhog/mailhog:latest" )) .withExposedPorts (1025 ,
76+ public static GenericContainer <?> mailhog = new GenericContainer <>( DockerImageName . parse ( "mailhog/mailhog:latest" ))
77+ .withExposedPorts (1025 ,
7778 8025 );
7879
7980 @ TestConfiguration
@@ -99,7 +100,8 @@ public JavaMailSender javaMailSender() {
99100 private String userUrl = "/user" ;
100101
101102 /**
102- * Tests that a user should be able to sign up. After signing up another user should not be able
103+ * Tests that a user should be able to sign up. After signing up another user
104+ * should not be able
103105 * use the same username or email.
104106 */
105107 @ Test
@@ -116,7 +118,8 @@ void userSignup() {
116118 }
117119
118120 /**
119- * Create a user, gets the registration token from the email. Uses the token to complete
121+ * Create a user, gets the registration token from the email. Uses the token to
122+ * complete
120123 * registration.
121124 */
122125 @ Test
@@ -245,9 +248,10 @@ void testRemoveUserPhoto_Success() throws Exception {
245248
246249 @ Test
247250 void getAllProivders () {
248- var response = restTemplate .getForEntity ("/user/oauth2Providers" , String [].class );
251+ var response = restTemplate .getForEntity ("/user/oauth2Providers" , Oauth2Source [].class );
249252
250- assertArrayEquals (new String [] {"github" }, response .getBody ());
253+ assertArrayEquals (new Oauth2Source [] { new Oauth2Source ("GitHub" , "https://github.com/favicon.ico" ) },
254+ response .getBody ());
251255
252256 }
253257}
0 commit comments