Mock out grading service API during testing
This will enable phase two review to be properly tested as well. Developers can remove the "service.grading.url" configuration from Tomcat's context.xml since it is no longer required.
This commit is contained in:
parent
3477c8f0c5
commit
764af42e4d
@ -23,6 +23,7 @@ services:
|
||||
- OAUTH2_RESOURCE_SERVER_INTROSPECTION_URI=https://oauth2-${VHOST}/introspect
|
||||
- OAUTH2_GS_AUTHORIZATION_URI=https://oauth2-gs-${VHOST}
|
||||
- OAUTH2_GS_CLIENT_REDIRECT_URI=https://${VHOST}/oauth/callback
|
||||
- SERVICE_GRADING_URL=http://mock-apis:8080/gs/api/
|
||||
networks:
|
||||
- traefik
|
||||
- internal
|
||||
@ -85,6 +86,17 @@ services:
|
||||
- "traefik.http.routers.oauth2-gs-${COMPOSE_PROJECT_NAME}.rule=Host(`oauth2-gs-${VHOST}`)"
|
||||
- "traefik.http.routers.oauth2-gs-${COMPOSE_PROJECT_NAME}.tls.certresolver=letsencrypt"
|
||||
|
||||
mock-apis:
|
||||
build: https://gitea.dsv.su.se/DMC/apimposter.git#main
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- internal
|
||||
environment:
|
||||
MOCK_BASE_PATH: / # HTTP base path for the mock server
|
||||
MOCK_FILE_PATH: /mocks
|
||||
volumes:
|
||||
- ./mock-api:/mocks
|
||||
|
||||
networks:
|
||||
traefik:
|
||||
name: traefik
|
||||
|
@ -24,3 +24,13 @@ services:
|
||||
- CLIENT_ID=scipro
|
||||
- CLIENT_SECRET=s3cr3t
|
||||
- CLIENT_REDIRECT_URI=http://localhost:8080/login/oauth2/code/scipro
|
||||
apimposter:
|
||||
build: https://gitea.dsv.su.se/DMC/apimposter.git
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- '59735:8080'
|
||||
environment:
|
||||
MOCK_BASE_PATH: / # HTTP base path for the mock server
|
||||
MOCK_FILE_PATH: /mocks
|
||||
volumes:
|
||||
- ./mock-api:/mocks
|
||||
|
72
mock-api/gs/api.yaml
Normal file
72
mock-api/gs/api.yaml
Normal file
@ -0,0 +1,72 @@
|
||||
- method: "GET"
|
||||
path: "/thesis/{thesisId}/author/{authorId}"
|
||||
response:
|
||||
status: 200
|
||||
headers:
|
||||
Content-Type: "application/json"
|
||||
body:
|
||||
- id: 1234 # examination id
|
||||
points: 5
|
||||
name:
|
||||
swedish: "Del 1"
|
||||
english: "Part 1"
|
||||
provkod: "THESIS-1"
|
||||
grades:
|
||||
- letter: "G"
|
||||
type: "G"
|
||||
- letter: "U"
|
||||
type: "U"
|
||||
titleRequired: false
|
||||
- id: 1235 # examination id
|
||||
points: 10
|
||||
name:
|
||||
swedish: "Del 2"
|
||||
english: "Part 2"
|
||||
provkod: "THESIS-2"
|
||||
grades:
|
||||
- letter: "A"
|
||||
type: "G"
|
||||
- letter: "B"
|
||||
type: "G"
|
||||
- letter: "C"
|
||||
type: "G"
|
||||
- letter: "D"
|
||||
type: "G"
|
||||
- letter: "E"
|
||||
type: "G"
|
||||
- letter: "FX"
|
||||
type: "U"
|
||||
- letter: "F"
|
||||
type: "U"
|
||||
titleRequired: true
|
||||
- method: "GET"
|
||||
path: "/thesis/{thesisId}/author/{authorId}/examination/{examinationId}"
|
||||
conditionalResponses:
|
||||
- conditions:
|
||||
path:
|
||||
examinationId: 1234
|
||||
response:
|
||||
status: 200
|
||||
headers:
|
||||
Content-Type: "application/json"
|
||||
body:
|
||||
grade: "P"
|
||||
reported: "2025-04-01"
|
||||
- conditions:
|
||||
path:
|
||||
examinationId: 1235
|
||||
response:
|
||||
status: 200
|
||||
headers:
|
||||
Content-Type: "application/json"
|
||||
body:
|
||||
grade: "A"
|
||||
reported: "2025-04-01"
|
||||
response:
|
||||
status: 204
|
||||
headers: {}
|
||||
- method: "POST"
|
||||
path: "/thesis/{thesisId}/author/{authorId}/examination/{examinationId}"
|
||||
response:
|
||||
status: 200
|
||||
headers: {}
|
@ -4,9 +4,6 @@ spring.datasource.password=${JDBC_DATABASE_PASSWORD}
|
||||
|
||||
profile=DEV
|
||||
|
||||
# No secrets available for branch deployment to branch.dsv.su.se
|
||||
# Will have to set up some mock API for this later
|
||||
service.grading.url=
|
||||
oauth.uri=${OAUTH2_GS_AUTHORIZATION_URI:http://localhost:59734/authorize}
|
||||
oauth.clientId=${OAUTH2_CLIENT_ID:scipro}
|
||||
oauth.clientSecret=${OAUTH2_CLIENT_SECRET:s3cr3t}
|
||||
|
@ -31,3 +31,5 @@ spring.security.oauth2.client.registration.scipro.provider=docker
|
||||
spring.security.oauth2.client.registration.scipro.client-id=${OAUTH2_CLIENT_ID:scipro}
|
||||
spring.security.oauth2.client.registration.scipro.client-secret=${OAUTH2_CLIENT_SECRET:s3cr3t}
|
||||
spring.security.oauth2.client.registration.scipro.authorization-grant-type=authorization_code
|
||||
|
||||
service.grading.url=${SERVICE_GRADING_URL:http://localhost:59735/gs/api/}
|
||||
|
Loading…
x
Reference in New Issue
Block a user