Skip to content

Commit cc8d74d

Browse files
committed
testing for all new oauth2Code
1 parent 68d7a1c commit cc8d74d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package dev.findfirst.users.controller;
22

33
import static dev.findfirst.utilities.HttpUtility.getHttpEntity;
4+
import static org.junit.Assert.assertArrayEquals;
45
import static org.junit.Assert.assertNotNull;
56
import static org.junit.jupiter.api.Assertions.assertEquals;
67
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -48,7 +49,9 @@
4849
@IntegrationTest
4950
@MockTypesense
5051
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
51-
@TestPropertySource(locations = "classpath:application-test.yml")
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"})
5255
class UserControllerTest {
5356

5457
TestRestTemplate restTemplate = new TestRestTemplate();
@@ -239,4 +242,12 @@ void testRemoveUserPhoto_Success() throws Exception {
239242

240243
assertEquals(HttpStatus.OK, response.getStatusCode());
241244
}
245+
246+
@Test
247+
void getAllProivders() {
248+
var response = restTemplate.getForEntity("/user/oauth2Providers", String[].class);
249+
250+
assertArrayEquals(new String[] {"github"}, response.getBody());
251+
252+
}
242253
}

0 commit comments

Comments
 (0)