diff --git a/mocks/studentportalen/daisy/profile.yaml b/mocks/studentportalen/daisy/profile.yaml new file mode 100644 index 0000000..9e0ea0d --- /dev/null +++ b/mocks/studentportalen/daisy/profile.yaml @@ -0,0 +1,10 @@ +- method: "GET" + path: "/" + delay: 200 + response: + status: 200 + headers: + Content-Type: "application/json" + body: + name: "Gregorious the Glorious" + mail: "greg_da_great@localhost" diff --git a/mocks/studentportalen/daisy/v1/bookings/group-rooms.yaml b/mocks/studentportalen/daisy/v1/bookings/group-rooms.yaml index b310897..47bebdc 100644 --- a/mocks/studentportalen/daisy/v1/bookings/group-rooms.yaml +++ b/mocks/studentportalen/daisy/v1/bookings/group-rooms.yaml @@ -384,6 +384,39 @@ detail: "Participants are invalid" violations: additional_participants: "One or more participant emails are invalid" + # Test error: Unknown error type -> DaisyUnexpectedResponseException + - conditions: + body: + name: "[TEST:unknown-error]" + response: + status: 400 + headers: + Content-Type: "application/problem+json" + body: + type: "daisy:some-future-error-type" + title: "Unknown error" + detail: "Something unexpected happened" + # Test error: Unparseable response body -> DaisyUnexpectedResponseException + - conditions: + body: + name: "[TEST:unparseable]" + response: + status: 400 + headers: + Content-Type: "text/plain" + body: "This is not JSON" + # Test error: Server error (5xx) -> DaisyServerError + - conditions: + body: + name: "[TEST:server-error]" + response: + status: 500 + headers: + Content-Type: "application/json" + body: + type: "daisy:internal-error" + title: "Internal Server Error" + detail: "Something went wrong" response: status: 200 headers: diff --git a/mocks/studentportalen/daisy/v1/calendar/schedule.ics.yaml b/mocks/studentportalen/daisy/v1/calendar/schedule.ics.yaml new file mode 100644 index 0000000..a88ab8b --- /dev/null +++ b/mocks/studentportalen/daisy/v1/calendar/schedule.ics.yaml @@ -0,0 +1,7 @@ +- method: "GET" + path: "/" + response: + status: 200 + headers: + Content-Type: "text/calendar" + body: "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Daisy//Schedule//EN\r\nBEGIN:VTIMEZONE\r\nTZID:Europe/Stockholm\r\nBEGIN:STANDARD\r\nDTSTART:19981025T020000\r\nRRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10\r\nTZOFFSETFROM:+0200\r\nTZOFFSETTO:+0100\r\nTZNAME:CET\r\nEND:STANDARD\r\nBEGIN:DAYLIGHT\r\nDTSTART:19980329T030000\r\nRRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3\r\nTZOFFSETFROM:+0100\r\nTZOFFSETTO:+0200\r\nTZNAME:CEST\r\nEND:DAYLIGHT\r\nEND:VTIMEZONE\r\nBEGIN:VEVENT\r\nDTSTART;TZID=Europe/Stockholm:{datetime+1d@08:00:yyyyMMdd'T'HHmmss}\r\nDTEND;TZID=Europe/Stockholm:{datetime+1d@10:00:yyyyMMdd'T'HHmmss}\r\nSUMMARY:Lecture - Introduction to Databases\r\nLOCATION:E52\r\nUID:daisy-1@studentportalen.dsv.su.se\r\nEND:VEVENT\r\nBEGIN:VEVENT\r\nDTSTART;TZID=Europe/Stockholm:{datetime+3d@13:00:yyyyMMdd'T'HHmmss}\r\nDTEND;TZID=Europe/Stockholm:{datetime+3d@15:00:yyyyMMdd'T'HHmmss}\r\nSUMMARY:Lab - SQL Queries\r\nLOCATION:PC-salen\r\nUID:daisy-2@studentportalen.dsv.su.se\r\nEND:VEVENT\r\nEND:VCALENDAR" diff --git a/mocks/studentportalen/daisy/v1/calendar/subscription-credentials.yaml b/mocks/studentportalen/daisy/v1/calendar/subscription-credentials.yaml new file mode 100644 index 0000000..3da2a59 --- /dev/null +++ b/mocks/studentportalen/daisy/v1/calendar/subscription-credentials.yaml @@ -0,0 +1,8 @@ +- method: "GET" + path: "/" + response: + status: 200 + headers: + Content-Type: "application/json" + body: + icsUrl: "/v1/calendar/schedule.ics" diff --git a/mocks/studentportalen/scipro/v1/calendar/schedule.ics.yaml b/mocks/studentportalen/scipro/v1/calendar/schedule.ics.yaml new file mode 100644 index 0000000..3ab328b --- /dev/null +++ b/mocks/studentportalen/scipro/v1/calendar/schedule.ics.yaml @@ -0,0 +1,7 @@ +- method: "GET" + path: "/" + response: + status: 200 + headers: + Content-Type: "text/calendar" + body: "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//SciPro//Schedule//EN\r\nBEGIN:VTIMEZONE\r\nTZID:Europe/Stockholm\r\nBEGIN:STANDARD\r\nDTSTART:19981025T020000\r\nRRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10\r\nTZOFFSETFROM:+0200\r\nTZOFFSETTO:+0100\r\nTZNAME:CET\r\nEND:STANDARD\r\nBEGIN:DAYLIGHT\r\nDTSTART:19980329T030000\r\nRRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3\r\nTZOFFSETFROM:+0100\r\nTZOFFSETTO:+0200\r\nTZNAME:CEST\r\nEND:DAYLIGHT\r\nEND:VTIMEZONE\r\nBEGIN:VEVENT\r\nDTSTART;TZID=Europe/Stockholm:{datetime+2d@10:00:yyyyMMdd'T'HHmmss}\r\nDTEND;TZID=Europe/Stockholm:{datetime+2d@11:00:yyyyMMdd'T'HHmmss}\r\nSUMMARY:Thesis Supervision Meeting\r\nLOCATION:Room 487\r\nUID:scipro-1@studentportalen.dsv.su.se\r\nEND:VEVENT\r\nBEGIN:VEVENT\r\nDTSTART;TZID=Europe/Stockholm:{datetime+5d@09:00:yyyyMMdd'T'HHmmss}\r\nDTEND;TZID=Europe/Stockholm:{datetime+5d@12:00:yyyyMMdd'T'HHmmss}\r\nSUMMARY:Final Seminar - Master Thesis\r\nLOCATION:Aula Magna\r\nUID:scipro-2@studentportalen.dsv.su.se\r\nEND:VEVENT\r\nEND:VCALENDAR" diff --git a/mocks/studentportalen/scipro/v1/schedule/mine/ics.yaml b/mocks/studentportalen/scipro/v1/schedule/mine/ics.yaml new file mode 100644 index 0000000..d2945b7 --- /dev/null +++ b/mocks/studentportalen/scipro/v1/schedule/mine/ics.yaml @@ -0,0 +1,8 @@ +- method: "GET" + path: "/" + response: + status: 200 + headers: + Content-Type: "application/json" + body: + fullyQualifiedUrl: "/v1/calendar/schedule.ics" diff --git a/mocks/studentportalen/sl/transport/v1.yaml b/mocks/studentportalen/sl/transport/v1.yaml new file mode 100644 index 0000000..5c79b10 --- /dev/null +++ b/mocks/studentportalen/sl/transport/v1.yaml @@ -0,0 +1,476 @@ +- method: GET + path: /sites/9302/departures + response: + status: 200 + headers: + Content-Type: application/json + body: + departures: + - destination: Akalla + direction_code: 1 + direction: Akalla + state: EXPECTED + display: 5 min + scheduled: '{datetime+5m}' + expected: '{datetime+5m}' + journey: + id: 2026033130481 + state: NORMALPROGRESS + prediction_state: NORMAL + stop_area: + id: 3251 + name: Kista + type: METROSTN + stop_point: + id: 3251 + name: Kista + designation: '1' + line: + id: 11 + designation: '11' + transport_authority_id: 1 + transport_mode: METRO + group_of_lines: Tunnelbanans blå linje + deviations: [ ] + - destination: Kungsträdgården + direction_code: 2 + direction: Kungsträdgården + state: EXPECTED + display: 6 min + scheduled: '{datetime+6m}' + expected: '{datetime+6m}' + journey: + id: 2026033130059 + state: NORMALPROGRESS + prediction_state: NORMAL + stop_area: + id: 3251 + name: Kista + type: METROSTN + stop_point: + id: 3252 + name: Kista + designation: '2' + line: + id: 11 + designation: '11' + transport_authority_id: 1 + transport_mode: METRO + group_of_lines: Tunnelbanans blå linje + deviations: [ ] + - destination: Kungsträdgården + direction_code: 2 + direction: Kungsträdgården + state: EXPECTED + display: 16 min + scheduled: '{datetime+16m}' + expected: '{datetime+16m}' + journey: + id: 2026033130060 + state: EXPECTED + stop_area: + id: 3251 + name: Kista + type: METROSTN + stop_point: + id: 3252 + name: Kista + designation: '2' + line: + id: 11 + designation: '11' + transport_authority_id: 1 + transport_mode: METRO + group_of_lines: Tunnelbanans blå linje + deviations: [ ] + - destination: Akalla + direction_code: 1 + direction: Akalla + state: EXPECTED + display: 17 min + scheduled: '{datetime+17m}' + expected: '{datetime+17m}' + journey: + id: 2026033130482 + state: NORMALPROGRESS + prediction_state: NORMAL + stop_area: + id: 3251 + name: Kista + type: METROSTN + stop_point: + id: 3251 + name: Kista + designation: '1' + line: + id: 11 + designation: '11' + transport_authority_id: 1 + transport_mode: METRO + group_of_lines: Tunnelbanans blå linje + deviations: [ ] + - destination: Akalla + direction_code: 1 + direction: Akalla + state: EXPECTED + display: 25 min + scheduled: '{datetime+25m}' + expected: '{datetime+25m}' + journey: + id: 2026033130483 + state: EXPECTED + stop_area: + id: 3251 + name: Kista + type: METROSTN + stop_point: + id: 3251 + name: Kista + designation: '1' + line: + id: 11 + designation: '11' + transport_authority_id: 1 + transport_mode: METRO + group_of_lines: Tunnelbanans blå linje + deviations: [ ] + - destination: Kungsträdgården + direction_code: 2 + direction: Kungsträdgården + state: EXPECTED + display: 26 min + scheduled: '{datetime+26m}' + expected: '{datetime+26m}' + journey: + id: 2026033130061 + state: EXPECTED + stop_area: + id: 3251 + name: Kista + type: METROSTN + stop_point: + id: 3252 + name: Kista + designation: '2' + line: + id: 11 + designation: '11' + transport_authority_id: 1 + transport_mode: METRO + group_of_lines: Tunnelbanans blå linje + deviations: [ ] + stop_deviations: [ ] +- method: GET + path: /sites/9507/departures + response: + status: 200 + headers: + Content-Type: application/json + body: + departures: + - destination: Södertälje centrum + direction_code: 1 + direction: Södertälje centrum + state: EXPECTED + display: 1 min + scheduled: '{datetime+1m}' + expected: '{datetime+1m}' + journey: + id: 2026040102729 + state: NORMALPROGRESS + prediction_state: NORMAL + stop_area: + id: 5051 + name: Helenelund + type: RAILWSTN + stop_point: + id: 5051 + name: Helenelund + designation: '3' + line: + id: 41 + designation: '41' + transport_authority_id: 1 + transport_mode: TRAIN + group_of_lines: Pendeltåg + deviations: [ ] + - destination: Uppsala C + direction_code: 2 + direction: Uppsala + state: EXPECTED + display: 5 min + scheduled: '{datetime+5m}' + expected: '{datetime+5m}' + journey: + id: 2026040102226 + state: NORMALPROGRESS + prediction_state: NORMAL + stop_area: + id: 5051 + name: Helenelund + type: RAILWSTN + stop_point: + id: 5052 + name: Helenelund + designation: '2' + line: + id: 40 + designation: '40' + transport_authority_id: 1 + transport_mode: TRAIN + group_of_lines: Pendeltåg + deviations: [ ] + - destination: Märsta + direction_code: 2 + direction: Märsta + state: EXPECTED + display: 12 min + scheduled: '{datetime+12m}' + expected: '{datetime+12m}' + journey: + id: 2026040102726 + state: NORMALPROGRESS + prediction_state: NORMAL + stop_area: + id: 5051 + name: Helenelund + type: RAILWSTN + stop_point: + id: 5052 + name: Helenelund + designation: '2' + line: + id: 41 + designation: '41' + transport_authority_id: 1 + transport_mode: TRAIN + group_of_lines: Pendeltåg + deviations: [ ] + - destination: Södertälje centrum + direction_code: 1 + direction: Södertälje centrum + state: EXPECTED + display: 16 min + scheduled: '{datetime+16m}' + expected: '{datetime+16m}' + journey: + id: 2026040102629 + state: NORMALPROGRESS + prediction_state: NORMAL + stop_area: + id: 5051 + name: Helenelund + type: RAILWSTN + stop_point: + id: 5051 + name: Helenelund + designation: '3' + line: + id: 41 + designation: '41' + transport_authority_id: 1 + transport_mode: TRAIN + group_of_lines: Pendeltåg + deviations: [ ] + - destination: Tumba + direction_code: 1 + direction: Södertälje + state: EXPECTED + display: 23 min + scheduled: '{datetime+23m}' + expected: '{datetime+23m}' + journey: + id: 2026040102229 + state: NORMALPROGRESS + prediction_state: NORMAL + stop_area: + id: 5051 + name: Helenelund + type: RAILWSTN + stop_point: + id: 5051 + name: Helenelund + designation: '3' + line: + id: 40 + designation: '40' + transport_authority_id: 1 + transport_mode: TRAIN + group_of_lines: Pendeltåg + deviations: [ ] + - destination: Märsta + direction_code: 2 + direction: Märsta + state: EXPECTED + display: 27 min + scheduled: '{datetime+27m}' + expected: '{datetime+27m}' + journey: + id: 2026040102628 + state: NORMALPROGRESS + prediction_state: NORMAL + stop_area: + id: 5051 + name: Helenelund + type: RAILWSTN + stop_point: + id: 5052 + name: Helenelund + designation: '2' + line: + id: 41 + designation: '41' + transport_authority_id: 1 + transport_mode: TRAIN + group_of_lines: Pendeltåg + deviations: [ ] + - destination: Södertälje centrum + direction_code: 1 + direction: Södertälje centrum + state: EXPECTED + display: '11:17' + scheduled: '{datetime+30m}' + expected: '{datetime+30m}' + journey: + id: 2026040102731 + state: EXPECTED + stop_area: + id: 5051 + name: Helenelund + type: RAILWSTN + stop_point: + id: 5051 + name: Helenelund + designation: '3' + line: + id: 41 + designation: '41' + transport_authority_id: 1 + transport_mode: TRAIN + group_of_lines: Pendeltåg + deviations: [ ] + - destination: Uppsala C + direction_code: 2 + direction: Uppsala + state: EXPECTED + display: '11:21' + scheduled: '{datetime+34m}' + expected: '{datetime+34m}' + journey: + id: 2026040102228 + state: NORMALPROGRESS + prediction_state: NORMAL + stop_area: + id: 5051 + name: Helenelund + type: RAILWSTN + stop_point: + id: 5052 + name: Helenelund + designation: '2' + line: + id: 40 + designation: '40' + transport_authority_id: 1 + transport_mode: TRAIN + group_of_lines: Pendeltåg + deviations: [ ] + - destination: Märsta + direction_code: 2 + direction: Märsta + state: EXPECTED + display: '11:28' + scheduled: '{datetime+41m}' + expected: '{datetime+41m}' + journey: + id: 2026040102728 + state: NORMALPROGRESS + prediction_state: NORMAL + stop_area: + id: 5051 + name: Helenelund + type: RAILWSTN + stop_point: + id: 5052 + name: Helenelund + designation: '2' + line: + id: 41 + designation: '41' + transport_authority_id: 1 + transport_mode: TRAIN + group_of_lines: Pendeltåg + deviations: [ ] + - destination: Tumba + direction_code: 1 + direction: Södertälje + state: EXPECTED + display: '11:39' + scheduled: '{datetime+52m}' + expected: '{datetime+52m}' + journey: + id: 2026040102231 + state: EXPECTED + stop_area: + id: 5051 + name: Helenelund + type: RAILWSTN + stop_point: + id: 5051 + name: Helenelund + designation: '3' + line: + id: 40 + designation: '40' + transport_authority_id: 1 + transport_mode: TRAIN + group_of_lines: Pendeltåg + deviations: [ ] + stop_deviations: [ ] +- method: GET + path: /sites + response: + status: 200 + headers: + Content-Type: application/json + body: + - id: 9001 + gid: 9091001000009000 + name: T-Centralen + alias: + - Tcentralen + abbreviation: TCE + lat: 59.3313754153065 + lon: 18.0604334292973 + valid: + from: '2018-11-23T00:00:00' + - id: 9203 + gid: 9091001000009204 + name: Universitetet + alias: + - Universitetet norra + abbreviation: UNT + lat: 59.3653618628997 + lon: 18.0538041584269 + valid: + from: '2015-07-24T00:00:00' + - id: 9302 + gid: 9091001000009302 + name: Kista + alias: + - Kista centrum + abbreviation: KIS + lat: 59.403472470728 + lon: 17.9425949765819 + valid: + from: '2015-03-03T00:00:00' + - id: 9507 + gid: 9091001000009508 + name: Helenelund + alias: + - Helenelunds station + abbreviation: HEL + lat: 59.4094616273478 + lon: 17.9622597026878 + valid: + from: '2012-06-23T00:00:00'