From 50b51a4be0b9df5c2e3c02055e66067bc1cb7692 Mon Sep 17 00:00:00 2001 From: nenzen Date: Thu, 26 Mar 2026 10:41:02 +0100 Subject: [PATCH] Add studentportalen mocks --- mocks/daisy/v1/bookings/group-rooms.yaml | 479 +++++++++++++++++++++++ mocks/scipro/v1/schedule/mine.yaml | 68 ++++ 2 files changed, 547 insertions(+) create mode 100644 mocks/daisy/v1/bookings/group-rooms.yaml create mode 100644 mocks/scipro/v1/schedule/mine.yaml diff --git a/mocks/daisy/v1/bookings/group-rooms.yaml b/mocks/daisy/v1/bookings/group-rooms.yaml new file mode 100644 index 0000000..b310897 --- /dev/null +++ b/mocks/daisy/v1/bookings/group-rooms.yaml @@ -0,0 +1,479 @@ +- method: "GET" + path: "/" + conditionalResponses: + - conditions: + query: + size: "small" + response: + status: 200 + headers: + Content-Type: "application/json" + body: + rooms: + - id: "g5-1" + name: "G5:1" + capacity: 5 + bookings: + - start: "{datetime+0d@08:00}" + end: "{datetime+0d@11:00}" + - start: "{datetime+0d@14:00}" + end: "{datetime+0d@16:00}" + - start: "{datetime+1d@09:00}" + end: "{datetime+1d@12:00}" + - start: "{datetime+1d@15:00}" + end: "{datetime+1d@17:00}" + - id: "g5-2" + name: "G5:2" + capacity: 5 + bookings: + - start: "{datetime+0d@09:00}" + end: "{datetime+0d@12:00}" + - start: "{datetime+0d@13:00}" + end: "{datetime+0d@15:00}" + - start: "{datetime+1d@08:00}" + end: "{datetime+1d@11:00}" + - start: "{datetime+1d@14:00}" + end: "{datetime+1d@16:00}" + - id: "g5-3" + name: "G5:3" + capacity: 5 + bookings: + - start: "{datetime+0d@08:00}" + end: "{datetime+0d@11:00}" + - start: "{datetime+0d@16:00}" + end: "{datetime+0d@18:00}" + - start: "{datetime+1d@09:00}" + end: "{datetime+1d@12:00}" + - start: "{datetime+1d@17:00}" + end: "{datetime+1d@19:00}" + - id: "g5-4" + name: "G5:4" + capacity: 5 + bookings: + - start: "{datetime+0d@09:00}" + end: "{datetime+0d@11:00}" + - start: "{datetime+0d@14:00}" + end: "{datetime+0d@16:00}" + - start: "{datetime+1d@09:00}" + end: "{datetime+1d@12:00}" + - start: "{datetime+1d@18:00}" + end: "{datetime+1d@20:00}" + - id: "g5-5" + name: "G5:5" + capacity: 5 + bookings: + - start: "{datetime+0d@08:00}" + end: "{datetime+0d@11:00}" + - start: "{datetime+0d@17:00}" + end: "{datetime+0d@19:00}" + - start: "{datetime+1d@09:00}" + end: "{datetime+1d@11:00}" + - start: "{datetime+1d@16:00}" + end: "{datetime+1d@18:00}" + maxBookableLength: "PT4H" + earliestBookingTime: "08:00:00" + latestBookingTime: "20:00:00" + minimumParticipants: 2 + maxDaysInFuture: 14 + - conditions: + query: + size: "large" + response: + status: 200 + headers: + Content-Type: "application/json" + body: + rooms: + - id: "g10-1" + name: "G10:1" + capacity: 10 + bookings: + - start: "{datetime+0d@08:00}" + end: "{datetime+0d@11:00}" + - start: "{datetime+0d@14:00}" + end: "{datetime+0d@17:00}" + - start: "{datetime+1d@13:00}" + end: "{datetime+1d@16:00}" + - start: "{datetime+1d@18:00}" + end: "{datetime+1d@20:00}" + - id: "g10-2" + name: "G10:2" + capacity: 10 + bookings: + - start: "{datetime+0d@09:00}" + end: "{datetime+0d@12:00}" + - start: "{datetime+0d@15:00}" + end: "{datetime+0d@18:00}" + - start: "{datetime+1d@14:00}" + end: "{datetime+1d@17:00}" + - start: "{datetime+1d@18:00}" + end: "{datetime+1d@20:00}" + - id: "g10-3" + name: "G10:3" + capacity: 10 + bookings: + - start: "{datetime+0d@08:00}" + end: "{datetime+0d@11:00}" + - start: "{datetime+0d@14:00}" + end: "{datetime+0d@17:00}" + - start: "{datetime+1d@13:00}" + end: "{datetime+1d@15:00}" + - start: "{datetime+1d@17:00}" + end: "{datetime+1d@20:00}" + - id: "g10-4" + name: "G10:4" + capacity: 10 + bookings: + - start: "{datetime+0d@09:00}" + end: "{datetime+0d@11:00}" + - start: "{datetime+0d@14:00}" + end: "{datetime+0d@16:00}" + - start: "{datetime+1d@14:00}" + end: "{datetime+1d@16:00}" + - start: "{datetime+1d@18:00}" + end: "{datetime+1d@20:00}" + - id: "g10-5" + name: "G10:5" + capacity: 10 + bookings: + - start: "{datetime+0d@08:00}" + end: "{datetime+0d@10:00}" + - start: "{datetime+0d@13:00}" + end: "{datetime+0d@16:00}" + - start: "{datetime+1d@13:00}" + end: "{datetime+1d@16:00}" + - start: "{datetime+1d@17:00}" + end: "{datetime+1d@19:00}" + maxBookableLength: "PT4H" + earliestBookingTime: "08:00:00" + latestBookingTime: "20:00:00" + minimumParticipants: 2 + maxDaysInFuture: 14 + response: + status: 200 + headers: + Content-Type: "application/json" + body: + rooms: + - id: "1" + name: "G5:1" + capacity: 5 + bookings: + - start: "{datetime+0d@08:00}" + end: "{datetime+0d@09:30}" + - start: "{datetime+0d@11:00}" + end: "{datetime+0d@13:00}" + - start: "{datetime+0d@15:00}" + end: "{datetime+0d@17:00}" + - id: "2" + name: "G5:2" + capacity: 5 + bookings: + - start: "{datetime+0d@09:00}" + end: "{datetime+0d@11:00}" + - start: "{datetime+0d@14:00}" + end: "{datetime+0d@16:00}" + - start: "{datetime+0d@18:00}" + end: "{datetime+0d@20:00}" + - id: "3" + name: "G5:3" + capacity: 8 + bookings: + - start: "{datetime+0d@08:00}" + end: "{datetime+0d@10:00}" + - start: "{datetime+0d@12:00}" + end: "{datetime+0d@14:00}" + - start: "{datetime+0d@16:30}" + end: "{datetime+0d@18:30}" + - id: "4" + name: "G10:1" + capacity: 12 + bookings: + - start: "{datetime+0d@10:00}" + end: "{datetime+0d@12:00}" + - start: "{datetime+0d@13:00}" + end: "{datetime+0d@15:00}" + maxBookableLength: "PT4H" + earliestBookingTime: "08:00:00" + latestBookingTime: "20:00:00" + minimumParticipants: 2 + maxDaysInFuture: 14 + +- method: "POST" + path: "/" + conditionalResponses: + # Test error: Forbidden - Swedish + - conditions: + headers: + Accept-Language: "sv-SE" + body: + name: "[TEST:forbidden]" + response: + status: 403 + headers: + Content-Type: "application/problem+json" + Content-Language: "sv-SE" + body: + type: "daisy:forbidden" + title: "Förbjuden" + detail: "Du har inte behörighet att boka rum just nu" + # Test error: Forbidden - English (default) + - conditions: + body: + name: "[TEST:forbidden]" + response: + status: 403 + headers: + Content-Type: "application/problem+json" + Content-Language: "en" + body: + type: "daisy:forbidden" + title: "Forbidden" + detail: "You are not allowed to book rooms at this time" + # Test error: Duration too long - Swedish + - conditions: + headers: + Accept-Language: "sv-SE" + body: + name: "[TEST:duration]" + response: + status: 400 + headers: + Content-Type: "application/problem+json" + Content-Language: "sv-SE" + body: + type: "daisy:duration-too-long" + title: "För lång bokning" + detail: "Bokningens längd överskrider maxgränsen (4 timmar)" + # Test error: Duration too long - English (default) + - conditions: + body: + name: "[TEST:duration]" + response: + status: 400 + headers: + Content-Type: "application/problem+json" + Content-Language: "en" + body: + type: "daisy:duration-too-long" + title: "Duration too long" + detail: "Booking duration exceeds maximum allowed (4 hours)" + # Test error: Too few participants - Swedish + - conditions: + headers: + Accept-Language: "sv-SE" + body: + name: "[TEST:participants]" + response: + status: 400 + headers: + Content-Type: "application/problem+json" + Content-Language: "sv-SE" + body: + type: "daisy:too-few-participants" + title: "För få deltagare" + detail: "Minst 2 deltagare krävs" + # Test error: Too few participants - English (default) + - conditions: + body: + name: "[TEST:participants]" + response: + status: 400 + headers: + Content-Type: "application/problem+json" + Content-Language: "en" + body: + type: "daisy:too-few-participants" + title: "Too few participants" + detail: "At least 2 participants are required" + # Test error: Validation errors - Swedish + - conditions: + headers: + Accept-Language: "sv-SE" + body: + name: "[TEST:validation]" + response: + status: 400 + headers: + Content-Type: "application/problem+json" + Content-Language: "sv-SE" + body: + type: "daisy:bad-request" + title: "Validering misslyckades" + detail: "Ett eller flera fält är ogiltiga" + violations: + name: "Titeln innehåller ogiltiga tecken" + additional_participants: "En eller flera e-postadresser är ogiltiga" + # Test error: Validation errors - English (default) + - conditions: + body: + name: "[TEST:validation]" + response: + status: 400 + headers: + Content-Type: "application/problem+json" + Content-Language: "en" + body: + type: "daisy:bad-request" + title: "Validation failed" + detail: "One or more fields are invalid" + violations: + name: "Title contains invalid characters" + additional_participants: "One or more participant emails are invalid" + # Test error: Validation error on title - Swedish + - conditions: + headers: + Accept-Language: "sv-SE" + body: + name: "[TEST:validation:title]" + response: + status: 400 + headers: + Content-Type: "application/problem+json" + Content-Language: "sv-SE" + body: + type: "daisy:bad-request" + title: "Validering misslyckades" + detail: "Titeln är ogiltig" + violations: + name: "Titeln innehåller ogiltiga tecken" + # Test error: Validation error on title - English (default) + - conditions: + body: + name: "[TEST:validation:title]" + response: + status: 400 + headers: + Content-Type: "application/problem+json" + Content-Language: "en" + body: + type: "daisy:bad-request" + title: "Validation failed" + detail: "Title is invalid" + violations: + name: "Title contains invalid characters" + # Test error: Validation error on participants - Swedish + - conditions: + headers: + Accept-Language: "sv-SE" + body: + name: "[TEST:validation:participants]" + response: + status: 400 + headers: + Content-Type: "application/problem+json" + Content-Language: "sv-SE" + body: + type: "daisy:bad-request" + title: "Validering misslyckades" + detail: "Deltagarna är ogiltiga" + violations: + additional_participants: "En eller flera e-postadresser är ogiltiga" + # Test error: Validation error on participants - English (default) + - conditions: + body: + name: "[TEST:validation:participants]" + response: + status: 400 + headers: + Content-Type: "application/problem+json" + Content-Language: "en" + body: + type: "daisy:bad-request" + title: "Validation failed" + detail: "Participants are invalid" + violations: + additional_participants: "One or more participant emails are invalid" + response: + status: 200 + headers: + Content-Type: "application/json" + body: + booking_id: "booking-12345" + name: "Test booking" + room_name: "G5:7" + start_time: "{datetime+1d@10:00}" + end_time: "{datetime+1d@12:00}" + additional_participants: + - "participant1@su.se" + - "participant2@su.se" + booked_by: "dev@localhost" + +- method: "GET" + path: "/mine" + response: + status: 200 + headers: + Content-Type: "application/json" + body: + - booking_id: "bk-20251025-001" + name: "Team standup" + room_name: "G5:1" + start_time: "{datetime+1d@08:00}" + end_time: "{datetime+1d@09:00}" + additional_participants: + - "kaan8888@su.se" + - "joan7777@su.se" + booked_by: "dev@localhost" + - booking_id: "bk-20251025-002" + name: "Study session" + room_name: "G5:3" + start_time: "{datetime+3d@14:00}" + end_time: "{datetime+3d@16:00}" + additional_participants: + - "stud1234@su.se" + - "stud5678@su.se" + booked_by: "dev@localhost" + - booking_id: "bk-20251025-003" + name: "Project work" + room_name: "G10:2" + start_time: "{datetime+5d@10:00}" + end_time: "{datetime+5d@13:00}" + additional_participants: + - "emma9999@su.se" + - "oliver1111@su.se" + - "sofia2222@su.se" + booked_by: "other@su.se" + - booking_id: "bk-20251025-004" + name: "Exam preparation" + room_name: "G5:4" + start_time: "{datetime+7d@15:00}" + end_time: "{datetime+7d@18:00}" + additional_participants: + - "lucas3333@su.se" + - "alice4444@su.se" + booked_by: "dev@localhost" + - booking_id: "bk-20251025-005" + name: "Group presentation practice" + room_name: "G10:3" + start_time: "{datetime+10d@11:00}" + end_time: "{datetime+10d@15:00}" + additional_participants: + - "noah5555@su.se" + - "mia6666@su.se" + - "elias7777@su.se" + - "liam8888@su.se" + booked_by: "dev@localhost" + +- method: "PUT" + path: "/{booking_id}" + response: + status: 200 + headers: + Content-Type: "application/json" + body: + booking_id: "{booking_id}" + name: "Updated booking" + room_name: "G5:7" + start_time: "{datetime+1d@10:00}" + end_time: "{datetime+1d@12:00}" + additional_participants: + - "updated@su.se" + booked_by: "dev@localhost" + +- method: "DELETE" + path: "/{booking_id}" + response: + status: 204 + headers: + Content-Type: "application/json" diff --git a/mocks/scipro/v1/schedule/mine.yaml b/mocks/scipro/v1/schedule/mine.yaml new file mode 100644 index 0000000..b9ac5a5 --- /dev/null +++ b/mocks/scipro/v1/schedule/mine.yaml @@ -0,0 +1,68 @@ +- method: GET + path: / + conditionalResponses: + - conditions: + headers: + Accept-Language: sv-SE + response: + status: 200 + headers: + Content-Type: application/json + Content-Language: und + body: + entries: + - id: scipro:first-meeting:123 + title: Första möte för projekt 'The future of healthcare in a world of AI agents' + description: https://zoom.example/join/1234-5678 + location: Zoom + start_time: "{datetime+1d@08:00:rfc3339}" + end_time: null + - id: scipro:first-meeting:124 + title: Första möte för projekt 'Gör sociala medier dig gladare?' + description: null + location: F1 + start_time: "{datetime+1d@10:00:rfc3339}" + end_time: null + - id: scipro:final-seminar:a1u9 + title: Slutseminarium för projekt 'Enterprise modelling - did it live up to the hype?' + description: TV crew will be filming + location: Aulan + start_time: "{datetime+0d@14:00:rfc3339}" + end_time: null + - id: scipro:final-seminar:9b8e87a + title: Slutseminarium för projekt 'Produktivitetsförändring av AI inom support' + description: null + location: https://zoom.example.com/join/abcd-efgh + start_time: "{datetime+17d@12:00:rfc3339}" + end_time: null + response: + status: 200 + headers: + Content-Type: application/json + Content-Language: und + body: + entries: + - id: scipro:first-meeting:123 + title: First meeting for project 'The future of healthcare in a world of AI agents' + description: https://zoom.example/join/1234-5678 + location: Zoom + start_time: "{datetime+1d@08:00:rfc3339}" + end_time: null + - id: scipro:first-meeting:124 + title: First meeting for project 'Gör sociala medier dig gladare?' + description: null + location: F1 + start_time: "{datetime+1d@10:00:rfc3339}" + end_time: null + - id: scipro:final-seminar:a1u9 + title: Final seminar for project 'Enterprise modelling - did it live up to the hype?' + description: TV crew will be filming + location: Aulan + start_time: "{datetime+0d@14:00:rfc3339}" + end_time: null + - id: scipro:final-seminar:9b8e87a + title: Final seminar for project 'Produktivitetsförändring av AI inom support' + description: null + location: https://zoom.example.com/join/abcd-efgh + start_time: "{datetime+17d@12:00:rfc3339}" + end_time: null -- 2.39.5