Skip to content

Commit

Permalink
FIX: now tests run
Browse files Browse the repository at this point in the history
  • Loading branch information
wiemanboy committed Oct 12, 2024
1 parent a167b9c commit a3efdb9
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ jobs:

- name: Run tests
run: mvn test
env:
AUTH0_CLIENT_ID: ${{ secrets.AUTH0_CLIENT_ID }}
AUTH0_CLIENT_SECRET: ${{ secrets.AUTH0_CLIENT_SECRET }}
"okta.oauth2.issuer": https://${{ secrets.OKTA_OAUTH2_ISSUER }}/
"okta.oauth2.audience": ${{ secrets.OKTA_OAUTH2_AUDIENCE }}
8 changes: 7 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ services:
MONGO_USER: admin
MONGO_PASSWORD: admin
MONGO_DB: dev_db
SPRING_DATA_MONGODB_URI: mongodb://admin:admin@mongo:27017/dev_db
MONGO_HOST: mongo
MONGO_PORT: 27017
MONGO_AUTH_DB: admin
AUTH0_BASE_URL: ${AUTH0_BASE_URL}
AUTH0_CLIENT_ID: ${AUTH0_CLIENT_ID}
AUTH0_CLIENT_SECRET: ${AUTH0_CLIENT_SECRET}
AUTH0_AUDIENCE: ${AUTH0_AUDIENCE}

mongo:
image: mongo:latest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package com.wiemanboy.wiemanapi;

import com.wiemanboy.wiemanapi.config.TestSecurityConfig;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
@SpringBootTest(classes = {TestSecurityConfig.class, WiemanApiApplication.class})
class WiemanApiApplicationTests {

@Test
void contextLoads() {
}
@Test
void contextLoads() {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.wiemanboy.wiemanapi.config;

import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository;
import org.springframework.security.oauth2.jwt.JwtDecoder;

import static org.mockito.Mockito.mock;

@TestConfiguration
public class TestSecurityConfig {

@Bean
public JwtDecoder jwtDecoder() {
return mock(JwtDecoder.class); // Mock JwtDecoder
}

@Bean
public ClientRegistrationRepository clientRegistrationRepository() {
return mock(ClientRegistrationRepository.class); // Mock ClientRegistrationRepository
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.wiemanboy.wiemanapi.presentation;

import com.wiemanboy.wiemanapi.WiemanApiApplication;
import com.wiemanboy.wiemanapi.builders.ProfileBuilder;
import com.wiemanboy.wiemanapi.config.TestSecurityConfig;
import com.wiemanboy.wiemanapi.data.ProfileRepository;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand All @@ -16,7 +18,7 @@
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

@SpringBootTest
@SpringBootTest(classes = {TestSecurityConfig.class, WiemanApiApplication.class})
@AutoConfigureMockMvc
public class ProfileControllerTest {

Expand Down
3 changes: 2 additions & 1 deletion src/test/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
debug=true
debug=true
spring.main.allow-bean-definition-overriding=true

0 comments on commit a3efdb9

Please sign in to comment.