From 69ca6c5115103c863281facc953925984c13861f Mon Sep 17 00:00:00 2001 From: Jesse Zong Date: Sun, 27 Oct 2024 13:23:35 -0400 Subject: [PATCH] Rewrite laundry mocks --- backend/laundry/views.py | 2 +- .../laundry/mock_geoboundaries_request.json | 225 ++++++++ .../laundry/mock_rooms_request_14089.json | 505 +++++++++++++++++ .../laundry/mock_rooms_request_14099.json | 507 ++++++++++++++++++ .../laundry/mock_rooms_requests_14100.json | 505 +++++++++++++++++ backend/tests/laundry/test_commands.py | 19 +- 6 files changed, 1756 insertions(+), 7 deletions(-) create mode 100644 backend/tests/laundry/mock_geoboundaries_request.json create mode 100644 backend/tests/laundry/mock_rooms_request_14089.json create mode 100644 backend/tests/laundry/mock_rooms_request_14099.json create mode 100644 backend/tests/laundry/mock_rooms_requests_14100.json diff --git a/backend/laundry/views.py b/backend/laundry/views.py index a4893971..94a7582b 100644 --- a/backend/laundry/views.py +++ b/backend/laundry/views.py @@ -156,7 +156,7 @@ def get(self, request): if cached_preferences is None: preferences = request.user.profile.laundry_preferences.all() cached_preferences = preferences.values_list("hall_id", flat=True) - # get all laundries with one of thse + # get all laundries with one of these valid_rooms = LaundryRoom.objects.filter(room_id__in=cached_preferences, new=True) cached_preferences = valid_rooms.values_list("room_id", flat=True) cache.set(key, cached_preferences, Cache.MONTH) diff --git a/backend/tests/laundry/mock_geoboundaries_request.json b/backend/tests/laundry/mock_geoboundaries_request.json new file mode 100644 index 00000000..8e04e8c6 --- /dev/null +++ b/backend/tests/laundry/mock_geoboundaries_request.json @@ -0,0 +1,225 @@ +{ + "id": "481806", + "organizationName": "University of Pennsylvania", + "merchantName": null, + "userGuid": "c7970c4c-5e73-4533-82ab-b25a0fcad7d3", + "userRole": { + "id": "485807", + "roleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + } + }, + "weightLookupKey": "POUND", + "isAtrium": false, + "isMeteredLaundry": false, + "isIncludedLaundry": true, + "atriumBalanceName": "", + "meteredBalanceName": "", + "geoBoundaries": [ + { + "fundsRestriction": null, + "hasCard": null, + "washAlertScaleX": null, + "washAlertScaleY": null, + "description": "University of Pennsylvania", + "id": "5610", + "isDup": false, + "geoBoundaryType": { + "id": "LOCATION" + }, + "breadcrumbIdArray": [ + "5610" + ], + "breadcrumbDisplayArray": [ + "University of Pennsylvania" + ], + "geoBoundaries": [ + { + "fundsRestriction": null, + "hasCard": null, + "washAlertScaleX": null, + "washAlertScaleY": null, + "description": "English House", + "id": "14146", + "isDup": false, + "geoBoundaryType": { + "id": "LOCATION" + }, + "breadcrumbIdArray": [ + "5610", + "14146" + ], + "breadcrumbDisplayArray": [ + "University of Pennsylvania", + "English House" + ], + "latitude": "39.9522188", + "longitude": "-75.1932137", + "rooms": [ + { + "id": "14089", + "roomName": "English House", + "breadcrumbDisplay": "University of Pennsylvania/English House/English House", + "breadcrumbId": "5610/14146/14089", + "isActive": true, + "createdAt": "2024-06-20T14:42:08.214Z", + "createdBy": "74297e47-3119-4037-9573-5ed1689788aa", + "updatedAt": "2024-06-20T14:42:08.214Z", + "updatedBy": null, + "geomName": "201 S 40th St, Philadelphia, PA 19104", + "latitude": "39.9522188", + "longitude": "-75.1932137", + "timeZoneName": "America/New_York", + "internationalTimeZoneName": "America/New_York", + "internationalTimeZoneAbbreviation": "EDT", + "hasCoin": true, + "hasVtm": false, + "hasWashAlert": true, + "washAlertImageUrl": null, + "washAlertXAxis": null, + "washAlertYAxis": null, + "canSms": true, + "serviceEmail": "campus-service@caleco.net", + "servicePhoneNumber": null, + "roomBanner": null, + "advancedGateway": true, + "connectionType": "CONNECTED", + "subscriptionExpired": false, + "locationPin": "QUAKER", + "signupBonusAmount": null, + "signupBonusExpirationDate": null, + "maxRedemptions": null, + "ordinalValue": 0 + } + ], + "ordinalValue": 0, + "isRetail": false + }, + { + "fundsRestriction": null, + "hasCard": null, + "washAlertScaleX": null, + "washAlertScaleY": null, + "description": "Harnwell College House", + "id": "14150", + "isDup": true, + "geoBoundaryType": { + "id": "LOCATION" + }, + "breadcrumbIdArray": [ + "5610", + "14150" + ], + "breadcrumbDisplayArray": [ + "University of Pennsylvania", + "Harnwell College House" + ], + "latitude": "39.9522188", + "longitude": "-75.1932137", + "rooms": [ + { + "id": "14099", + "roomName": "Harnwell 10th Floor", + "breadcrumbDisplay": "University of Pennsylvania/Harnwell College House/Harnwell 10th Floor", + "breadcrumbId": "5610/14150/14099", + "isActive": true, + "createdAt": "2024-06-20T15:53:02.144Z", + "createdBy": "74297e47-3119-4037-9573-5ed1689788aa", + "updatedAt": "2024-06-20T15:53:02.144Z", + "updatedBy": null, + "geomName": "201 S 40th St, Philadelphia, PA 19104", + "latitude": "39.9522188", + "longitude": "-75.1932137", + "timeZoneName": "America/New_York", + "internationalTimeZoneName": "America/New_York", + "internationalTimeZoneAbbreviation": "EDT", + "hasCoin": true, + "hasVtm": false, + "hasWashAlert": true, + "washAlertImageUrl": null, + "washAlertXAxis": null, + "washAlertYAxis": null, + "canSms": true, + "serviceEmail": "campus-service@caleco.net", + "servicePhoneNumber": null, + "roomBanner": null, + "advancedGateway": true, + "connectionType": "CONNECTED", + "subscriptionExpired": false, + "locationPin": "QUAKER", + "signupBonusAmount": null, + "signupBonusExpirationDate": null, + "maxRedemptions": null, + "ordinalValue": 0 + }, + { + "id": "14100", + "roomName": "Harnwell 12th Floor", + "breadcrumbDisplay": "University of Pennsylvania/Harnwell College House/Harnwell 12th Floor", + "breadcrumbId": "5610/14150/14100", + "isActive": true, + "createdAt": "2024-06-20T16:15:21.671Z", + "createdBy": "74297e47-3119-4037-9573-5ed1689788aa", + "updatedAt": "2024-06-20T16:15:21.671Z", + "updatedBy": null, + "geomName": "201 S 40th St, Philadelphia, PA 19104", + "latitude": "39.9522188", + "longitude": "-75.1932137", + "timeZoneName": "America/New_York", + "internationalTimeZoneName": "America/New_York", + "internationalTimeZoneAbbreviation": "EDT", + "hasCoin": true, + "hasVtm": false, + "hasWashAlert": true, + "washAlertImageUrl": null, + "washAlertXAxis": null, + "washAlertYAxis": null, + "canSms": true, + "serviceEmail": "campus-service@caleco.net", + "servicePhoneNumber": null, + "roomBanner": null, + "advancedGateway": true, + "connectionType": "CONNECTED", + "subscriptionExpired": false, + "locationPin": "QUAKER", + "signupBonusAmount": null, + "signupBonusExpirationDate": null, + "maxRedemptions": null, + "ordinalValue": 1 + }, + ], + "ordinalValue": 4, + "isRetail": false + }, + ], + "ordinalValue": 0, + "isRetail": false + } + ], + "currency": { + "name": "US Dollars", + "divisor": 100, + "decimalPlaces": 2, + "iso4217Code": "USD", + "iso4217Id": "840", + "id": "840", + "symbol": "$", + "thousandsSeparator": ",", + "decimalSeparator": ".", + "overrideDecimalPlaces": null + }, + "country": { + "id": "1", + "name": "United States", + "isoCountryName": "United States of America", + "isoCountryCode": "US" + }, + "auxFundsType": null, + "hasCvvVerification": false, + "hasAddressVerification": false, + "isRetail": false, + "isCrm": false, + "isTrade": false, + "hasMailbox": false, + "isoStartDayOfWeek": "7" +} \ No newline at end of file diff --git a/backend/tests/laundry/mock_rooms_request_14089.json b/backend/tests/laundry/mock_rooms_request_14089.json new file mode 100644 index 00000000..63f36c67 --- /dev/null +++ b/backend/tests/laundry/mock_rooms_request_14089.json @@ -0,0 +1,505 @@ +[ + { + "id": "442890", + "room": { + "id": "14089", + "roomName": "English House" + }, + "isDryer": true, + "isActive": true, + "isWasher": false, + "controlId": "176099620618346500", + "createdAt": "2024-07-24T15:07:22.001628", + "createdBy": 2, + "updatedAt": "2024-07-24T15:07:22.001628", + "updatedBy": null, + "isExternal": false, + "machineName": "Machine Node - 4", + "machineType": { + "id": "20", + "isDryer": true, + "isWasher": false, + "typeName": "Dryer" + }, + "modelNumber": "SDENYRGS176TW01", + "networkNode": "4", + "organization": { + "id": "481806", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "organizationName": "University of Pennsylvania" + }, + "serialNumber": "2405022776", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "machineNumber": "0004", + "machineAuditType": { + "id": "TITAN_T4", + "typeName": "TITAN_T4" + }, + "machineGeneration": null, + "networkController": null, + "machineAuditGroupType": { + "id": "TITAN", + "typeName": "Quantum Gold Pro" + }, + "currentStatus": { + "canTopOff": true, + "controlId": "176099620618346500", + "createdAt": "2024-10-27T16:54:02.706000", + "displayStatus": { + "id": "0", + "times": [ + 1000, + 1000 + ], + "values": [ + "CLo5E", + "door" + ] + }, + "gatewayName": "37e5b85195ad97b00f7e45eb07c0b8ee", + "id": "442890", + "isDoorOpen": false, + "linkQualityIndicator": 65, + "microType": 0, + "receivedAt": "2024-10-27T16:54:02.706000", + "remainingSeconds": 3600, + "remainingVend": 0, + "roomId": "14089", + "selectedCycle": { + "id": 4, + "name": "MEDIUM" + }, + "selectedModifier": { + "id": 0 + }, + "statusId": "AVAILABLE", + "topOffTime": 300, + "topOffVend": 25, + "topoffFullyDisabled": false, + "uuid": "52f7bf39-56c8-4d2e-b946-f9fadc8fbb20" + }, + "ordinalValue": 0 + }, + { + "id": "442888", + "room": { + "id": "14089", + "roomName": "English House" + }, + "isDryer": false, + "isActive": true, + "isWasher": true, + "controlId": "143031774052786180", + "createdAt": "2024-07-24T15:07:17.440014", + "createdBy": 2, + "updatedAt": "2024-07-24T15:07:17.440014", + "updatedBy": null, + "isExternal": false, + "machineName": "Machine Node - 1", + "machineType": { + "id": "10", + "isDryer": false, + "isWasher": true, + "typeName": "Frontload Washer" + }, + "modelNumber": "SFNNYRSP116TW01", + "networkNode": "1", + "organization": { + "id": "481806", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "organizationName": "University of Pennsylvania" + }, + "serialNumber": "2310023277", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "machineNumber": "0001", + "machineAuditType": { + "id": "TITAN_T4", + "typeName": "TITAN_T4" + }, + "machineGeneration": null, + "networkController": null, + "machineAuditGroupType": { + "id": "TITAN", + "typeName": "Quantum Gold Pro" + }, + "currentStatus": { + "canTopOff": false, + "controlId": "143031774052786180", + "createdAt": "2024-10-27T17:01:01.079000", + "displayStatus": { + "id": "0", + "times": [ + 1000 + ], + "values": [ + "oPEn " + ] + }, + "gatewayName": "37e5b85195ad97b00f7e45eb07c0b8ee", + "id": "442888", + "isDoorOpen": false, + "linkQualityIndicator": 53, + "microType": 0, + "receivedAt": "2024-10-27T17:01:01.079000", + "remainingSeconds": 1800, + "remainingVend": 0, + "roomId": "14089", + "selectedCycle": { + "id": 2, + "name": "NORMAL_WARM" + }, + "selectedModifier": { + "id": 0, + "name": "LIGHT" + }, + "statusId": "COMPLETE", + "topOffTime": 0, + "topOffVend": 0, + "topoffFullyDisabled": true, + "uuid": "95599a7d-1fe6-4729-ae1a-4be79cfdcaf8" + }, + "ordinalValue": 1 + }, + { + "id": "442886", + "room": { + "id": "14089", + "roomName": "English House" + }, + "isDryer": false, + "isActive": true, + "isWasher": true, + "controlId": "142594022396043268", + "createdAt": "2024-07-24T15:07:16.013735", + "createdBy": 2, + "updatedAt": "2024-07-24T15:07:16.013735", + "updatedBy": null, + "isExternal": false, + "machineName": "Machine Node - 2", + "machineType": { + "id": "10", + "isDryer": false, + "isWasher": true, + "typeName": "Frontload Washer" + }, + "modelNumber": "SFNNYRSP116TW01", + "networkNode": "2", + "organization": { + "id": "481806", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "organizationName": "University of Pennsylvania" + }, + "serialNumber": "2310045791", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "machineNumber": "0002", + "machineAuditType": { + "id": "TITAN_T4", + "typeName": "TITAN_T4" + }, + "machineGeneration": null, + "networkController": null, + "machineAuditGroupType": { + "id": "TITAN", + "typeName": "Quantum Gold Pro" + }, + "currentStatus": { + "canTopOff": false, + "controlId": "142594022396043268", + "createdAt": "2024-10-27T17:03:04.917000", + "displayStatus": { + "id": "0", + "times": [ + 1000 + ], + "values": [ + " :18" + ] + }, + "gatewayName": "37e5b85195ad97b00f7e45eb07c0b8ee", + "id": "442886", + "isDoorOpen": false, + "linkQualityIndicator": 53, + "microType": 0, + "receivedAt": "2024-10-27T17:03:04.917000", + "remainingSeconds": 1028, + "remainingVend": 0, + "roomId": "14089", + "selectedCycle": { + "id": 3, + "name": "NORMAL_COLD" + }, + "selectedModifier": { + "id": 0, + "name": "LIGHT" + }, + "statusId": "IN_USE", + "topOffTime": 0, + "topOffVend": 0, + "topoffFullyDisabled": true, + "uuid": "abf455ce-c829-4076-b4b6-90607f376551" + }, + "ordinalValue": 2 + }, + { + "id": "442885", + "room": { + "id": "14089", + "roomName": "English House" + }, + "isDryer": false, + "isActive": true, + "isWasher": true, + "controlId": "142593846302384132", + "createdAt": "2024-07-24T15:07:15.014176", + "createdBy": 2, + "updatedAt": "2024-07-24T15:07:15.014176", + "updatedBy": null, + "isExternal": false, + "machineName": "Machine Node - 3", + "machineType": { + "id": "10", + "isDryer": false, + "isWasher": true, + "typeName": "Frontload Washer" + }, + "modelNumber": "SFNNYRSP116TW01", + "networkNode": "3", + "organization": { + "id": "481806", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "organizationName": "University of Pennsylvania" + }, + "serialNumber": "2310045788", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "machineNumber": "0003", + "machineAuditType": { + "id": "TITAN_T4", + "typeName": "TITAN_T4" + }, + "machineGeneration": null, + "networkController": null, + "machineAuditGroupType": { + "id": "TITAN", + "typeName": "Quantum Gold Pro" + }, + "currentStatus": { + "canTopOff": false, + "controlId": "142593846302384132", + "createdAt": "2024-10-27T17:03:05.920000", + "displayStatus": { + "id": "0", + "times": [ + 1000 + ], + "values": [ + " 03" + ] + }, + "gatewayName": "37e5b85195ad97b00f7e45eb07c0b8ee", + "id": "442885", + "isDoorOpen": false, + "linkQualityIndicator": 64, + "microType": 0, + "receivedAt": "2024-10-27T17:03:05.920000", + "remainingSeconds": 138, + "remainingVend": 0, + "roomId": "14089", + "selectedCycle": { + "id": 2, + "name": "NORMAL_WARM" + }, + "selectedModifier": { + "id": 0, + "name": "LIGHT" + }, + "statusId": "IN_USE", + "topOffTime": 0, + "topOffVend": 0, + "topoffFullyDisabled": true, + "uuid": "244ae682-041b-451e-9767-d6bda3556a0b" + }, + "ordinalValue": 3 + }, + { + "id": "442887", + "room": { + "id": "14089", + "roomName": "English House" + }, + "isDryer": true, + "isActive": true, + "isWasher": false, + "controlId": "177830445193994244", + "createdAt": "2024-07-24T15:07:16.548421", + "createdBy": 2, + "updatedAt": "2024-07-24T15:07:16.548421", + "updatedBy": null, + "isExternal": false, + "machineName": "Machine Node - 5", + "machineType": { + "id": "20", + "isDryer": true, + "isWasher": false, + "typeName": "Dryer" + }, + "modelNumber": "SDENYRGS176TW01", + "networkNode": "5", + "organization": { + "id": "481806", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "organizationName": "University of Pennsylvania" + }, + "serialNumber": "2405015200", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "machineNumber": "0005", + "machineAuditType": { + "id": "TITAN_T4", + "typeName": "TITAN_T4" + }, + "machineGeneration": null, + "networkController": null, + "machineAuditGroupType": { + "id": "TITAN", + "typeName": "Quantum Gold Pro" + }, + "currentStatus": { + "canTopOff": true, + "controlId": "177830445193994244", + "createdAt": "2024-10-27T17:03:07.675000", + "displayStatus": { + "id": "0", + "times": [ + 1000 + ], + "values": [ + " :44" + ] + }, + "gatewayName": "37e5b85195ad97b00f7e45eb07c0b8ee", + "id": "442887", + "isDoorOpen": false, + "linkQualityIndicator": 58, + "microType": 0, + "receivedAt": "2024-10-27T17:03:07.675000", + "remainingSeconds": 2604, + "remainingVend": 0, + "roomId": "14089", + "selectedCycle": { + "id": 1, + "name": "HIGH" + }, + "selectedModifier": { + "id": 0 + }, + "statusId": "IN_USE", + "topOffTime": 300, + "topOffVend": 25, + "topoffFullyDisabled": false, + "uuid": "8a94d44d-fd31-4545-b6b3-e118b0c8302e" + }, + "ordinalValue": 4 + }, + { + "id": "442889", + "room": { + "id": "14089", + "roomName": "English House" + }, + "isDryer": true, + "isActive": true, + "isWasher": false, + "controlId": "177830470963798020", + "createdAt": "2024-07-24T15:07:21.831619", + "createdBy": 2, + "updatedAt": "2024-07-24T15:07:21.831619", + "updatedBy": null, + "isExternal": false, + "machineName": "Machine Node - 6", + "machineType": { + "id": "20", + "isDryer": true, + "isWasher": false, + "typeName": "Dryer" + }, + "modelNumber": "SDENYRGS176TW01", + "networkNode": "6", + "organization": { + "id": "481806", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "organizationName": "University of Pennsylvania" + }, + "serialNumber": "2405015201", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "machineNumber": "0006", + "machineAuditType": { + "id": "TITAN_T4", + "typeName": "TITAN_T4" + }, + "machineGeneration": null, + "networkController": null, + "machineAuditGroupType": { + "id": "TITAN", + "typeName": "Quantum Gold Pro" + }, + "currentStatus": { + "canTopOff": true, + "controlId": "177830470963798020", + "createdAt": "2024-10-27T17:03:04.184000", + "displayStatus": { + "id": "0", + "times": [ + 1000 + ], + "values": [ + " 18" + ] + }, + "gatewayName": "37e5b85195ad97b00f7e45eb07c0b8ee", + "id": "442889", + "isDoorOpen": false, + "linkQualityIndicator": 56, + "microType": 0, + "receivedAt": "2024-10-27T17:03:04.184000", + "remainingSeconds": 1044, + "remainingVend": 0, + "roomId": "14089", + "selectedCycle": { + "id": 1, + "name": "HIGH" + }, + "selectedModifier": { + "id": 0 + }, + "statusId": "IN_USE", + "topOffTime": 300, + "topOffVend": 25, + "topoffFullyDisabled": false, + "uuid": "609573cd-6704-48a5-8616-d4e07c02234b" + }, + "ordinalValue": 5 + } +] \ No newline at end of file diff --git a/backend/tests/laundry/mock_rooms_request_14099.json b/backend/tests/laundry/mock_rooms_request_14099.json new file mode 100644 index 00000000..e21235f2 --- /dev/null +++ b/backend/tests/laundry/mock_rooms_request_14099.json @@ -0,0 +1,507 @@ +[ + { + "id": "452710", + "room": { + "id": "14099", + "roomName": "Harnwell 10th Floor" + }, + "isDryer": false, + "isActive": true, + "isWasher": true, + "controlId": "148190089904824324", + "createdAt": "2024-07-30T17:42:08.184344", + "createdBy": 2, + "updatedAt": "2024-07-30T17:42:08.184344", + "updatedBy": null, + "isExternal": false, + "machineName": "Machine Node - 28", + "machineType": { + "id": "10", + "isDryer": false, + "isWasher": true, + "typeName": "Frontload Washer" + }, + "modelNumber": "SFNNYRSP116TW01", + "networkNode": "28", + "organization": { + "id": "481806", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "organizationName": "University of Pennsylvania" + }, + "serialNumber": "2403015356", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "machineNumber": "0028", + "machineAuditType": { + "id": "TITAN_T4", + "typeName": "TITAN_T4" + }, + "machineGeneration": null, + "networkController": null, + "machineAuditGroupType": { + "id": "TITAN", + "typeName": "Quantum Gold Pro" + }, + "currentStatus": { + "canTopOff": false, + "controlId": "148190089904824324", + "createdAt": "2024-10-27T17:01:06.186000", + "displayStatus": { + "id": "0", + "times": [ + 1000 + ], + "values": [ + "5tArt " + ] + }, + "gatewayName": "334b35ddd2700be0075c5af0aa247aa9", + "id": "452710", + "isDoorOpen": false, + "linkQualityIndicator": 59, + "microType": 0, + "receivedAt": "2024-10-27T17:01:06.186000", + "remainingSeconds": 1800, + "remainingVend": 0, + "roomId": "14099", + "selectedCycle": { + "id": 3, + "name": "NORMAL_COLD" + }, + "selectedModifier": { + "id": 0, + "name": "LIGHT" + }, + "statusId": "AVAILABLE", + "topOffTime": 0, + "topOffVend": 0, + "topoffFullyDisabled": true, + "uuid": "479c5648-a406-47f7-9c0e-56e424ada3d8" + }, + "ordinalValue": 0 + }, + { + "id": "452707", + "room": { + "id": "14099", + "roomName": "Harnwell 10th Floor" + }, + "isDryer": true, + "isActive": true, + "isWasher": false, + "controlId": "172669286073606148", + "createdAt": "2024-07-30T17:42:03.25572", + "createdBy": 2, + "updatedAt": "2024-07-30T17:42:03.25572", + "updatedBy": null, + "isExternal": false, + "machineName": "Machine Node - 27", + "machineType": { + "id": "20", + "isDryer": true, + "isWasher": false, + "typeName": "Dryer" + }, + "modelNumber": "SDENYRGS176TW01", + "networkNode": "27", + "organization": { + "id": "481806", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "organizationName": "University of Pennsylvania" + }, + "serialNumber": "2403050733", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "machineNumber": "0027", + "machineAuditType": { + "id": "TITAN_T4", + "typeName": "TITAN_T4" + }, + "machineGeneration": null, + "networkController": null, + "machineAuditGroupType": { + "id": "TITAN", + "typeName": "Quantum Gold Pro" + }, + "currentStatus": { + "canTopOff": true, + "controlId": "172669286073606148", + "createdAt": "2024-10-27T16:49:04.122000", + "displayStatus": { + "id": "0", + "times": [ + 1000, + 1000 + ], + "values": [ + "CLo5E", + "door" + ] + }, + "gatewayName": "334b35ddd2700be0075c5af0aa247aa9", + "id": "452707", + "isDoorOpen": false, + "linkQualityIndicator": 43, + "microType": 0, + "receivedAt": "2024-10-27T16:49:04.122000", + "remainingSeconds": 3600, + "remainingVend": 0, + "roomId": "14099", + "selectedCycle": { + "id": 4, + "name": "MEDIUM" + }, + "selectedModifier": { + "id": 0 + }, + "statusId": "AVAILABLE", + "topOffTime": 300, + "topOffVend": 25, + "topoffFullyDisabled": false, + "uuid": "be4e14d9-127f-48e0-866c-577fd09dafaa" + }, + "ordinalValue": 1 + }, + { + "id": "452711", + "room": { + "id": "14099", + "roomName": "Harnwell 10th Floor" + }, + "isDryer": false, + "isActive": true, + "isWasher": true, + "controlId": "173953833481969668", + "createdAt": "2024-07-30T17:42:14.343464", + "createdBy": 2, + "updatedAt": "2024-07-30T17:42:14.343464", + "updatedBy": null, + "isExternal": false, + "machineName": "Machine Node - 29", + "machineType": { + "id": "10", + "isDryer": false, + "isWasher": true, + "typeName": "Frontload Washer" + }, + "modelNumber": "SFNNYRSP116TW01", + "networkNode": "29", + "organization": { + "id": "481806", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "organizationName": "University of Pennsylvania" + }, + "serialNumber": "2404029726", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "machineNumber": "0029", + "machineAuditType": { + "id": "TITAN_T4", + "typeName": "TITAN_T4" + }, + "machineGeneration": null, + "networkController": null, + "machineAuditGroupType": { + "id": "TITAN", + "typeName": "Quantum Gold Pro" + }, + "currentStatus": { + "canTopOff": false, + "controlId": "173953833481969668", + "createdAt": "2024-10-27T17:04:02.815000", + "displayStatus": { + "id": "0", + "times": [ + 1000 + ], + "values": [ + " :15" + ] + }, + "gatewayName": "334b35ddd2700be0075c5af0aa247aa9", + "id": "452711", + "isDoorOpen": false, + "linkQualityIndicator": 65, + "microType": 0, + "receivedAt": "2024-10-27T17:04:02.815000", + "remainingSeconds": 868, + "remainingVend": 0, + "roomId": "14099", + "selectedCycle": { + "id": 7, + "name": "DELICATE_HOT" + }, + "selectedModifier": { + "id": 2, + "name": "HEAVY" + }, + "statusId": "IN_USE", + "topOffTime": 0, + "topOffVend": 0, + "topoffFullyDisabled": true, + "uuid": "8eb1203b-ae9e-4954-8acf-f5c8efb1aff9" + }, + "ordinalValue": 2 + }, + { + "id": "452708", + "room": { + "id": "14099", + "roomName": "Harnwell 10th Floor" + }, + "isDryer": false, + "isActive": true, + "isWasher": true, + "controlId": "148190094199791620", + "createdAt": "2024-07-30T17:42:05.262754", + "createdBy": 2, + "updatedAt": "2024-07-30T17:42:05.262754", + "updatedBy": null, + "isExternal": false, + "machineName": "Machine Node - 30", + "machineType": { + "id": "10", + "isDryer": false, + "isWasher": true, + "typeName": "Frontload Washer" + }, + "modelNumber": "SFNNYRSP116TW01", + "networkNode": "30", + "organization": { + "id": "481806", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "organizationName": "University of Pennsylvania" + }, + "serialNumber": "2403015371", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "machineNumber": "0030", + "machineAuditType": { + "id": "TITAN_T4", + "typeName": "TITAN_T4" + }, + "machineGeneration": null, + "networkController": null, + "machineAuditGroupType": { + "id": "TITAN", + "typeName": "Quantum Gold Pro" + }, + "currentStatus": { + "canTopOff": false, + "controlId": "148190094199791620", + "createdAt": "2024-10-27T17:03:03.840000", + "displayStatus": { + "id": "0", + "times": [ + 1000 + ], + "values": [ + " :16" + ] + }, + "gatewayName": "334b35ddd2700be0075c5af0aa247aa9", + "id": "452708", + "isDoorOpen": false, + "linkQualityIndicator": 51, + "microType": 0, + "receivedAt": "2024-10-27T17:03:03.840000", + "remainingSeconds": 944, + "remainingVend": 0, + "roomId": "14099", + "selectedCycle": { + "id": 7, + "name": "DELICATE_HOT" + }, + "selectedModifier": { + "id": 2, + "name": "HEAVY" + }, + "statusId": "IN_USE", + "topOffTime": 0, + "topOffVend": 0, + "topoffFullyDisabled": true, + "uuid": "3eb22a05-e2fc-426a-b297-459de85c98d1" + }, + "ordinalValue": 3 + }, + { + "id": "452706", + "room": { + "id": "14099", + "roomName": "Harnwell 10th Floor" + }, + "isDryer": true, + "isActive": true, + "isWasher": false, + "controlId": "172669247418900484", + "createdAt": "2024-07-30T17:41:58.981704", + "createdBy": 2, + "updatedAt": "2024-07-30T17:41:58.981704", + "updatedBy": null, + "isExternal": false, + "machineName": "Machine Node - 25", + "machineType": { + "id": "20", + "isDryer": true, + "isWasher": false, + "typeName": "Dryer" + }, + "modelNumber": "SDENYRGS176TW01", + "networkNode": "25", + "organization": { + "id": "481806", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "organizationName": "University of Pennsylvania" + }, + "serialNumber": "2403050789", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "machineNumber": "0025", + "machineAuditType": { + "id": "TITAN_T4", + "typeName": "TITAN_T4" + }, + "machineGeneration": null, + "networkController": null, + "machineAuditGroupType": { + "id": "TITAN", + "typeName": "Quantum Gold Pro" + }, + "currentStatus": { + "canTopOff": true, + "controlId": "172669247418900484", + "createdAt": "2024-10-27T17:01:03.045000", + "displayStatus": { + "id": "0", + "times": [ + 1000, + 1000 + ], + "values": [ + "CLo5E", + "door" + ] + }, + "gatewayName": "334b35ddd2700be0075c5af0aa247aa9", + "id": "452706", + "isDoorOpen": false, + "linkQualityIndicator": 60, + "microType": 0, + "receivedAt": "2024-10-27T17:01:03.045000", + "remainingSeconds": 0, + "remainingVend": 0, + "roomId": "14099", + "selectedCycle": { + "id": 4, + "name": "MEDIUM" + }, + "selectedModifier": { + "id": 0 + }, + "statusId": "COMPLETE", + "topOffTime": 300, + "topOffVend": 25, + "topoffFullyDisabled": false, + "uuid": "4e69aab9-0236-4e6d-b4e2-01ba6e9fdb34" + }, + "ordinalValue": 4 + }, + { + "id": "452709", + "room": { + "id": "14099", + "roomName": "Harnwell 10th Floor" + }, + "isDryer": true, + "isActive": true, + "isWasher": false, + "controlId": "172670157951967236", + "createdAt": "2024-07-30T17:42:08.162923", + "createdBy": 2, + "updatedAt": "2024-07-30T17:42:08.162923", + "updatedBy": null, + "isExternal": false, + "machineName": "Machine Node - 26", + "machineType": { + "id": "20", + "isDryer": true, + "isWasher": false, + "typeName": "Dryer" + }, + "modelNumber": "SDENYRGS176TW01", + "networkNode": "26", + "organization": { + "id": "481806", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "organizationName": "University of Pennsylvania" + }, + "serialNumber": "2403045943", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "machineNumber": "0026", + "machineAuditType": { + "id": "TITAN_T4", + "typeName": "TITAN_T4" + }, + "machineGeneration": null, + "networkController": null, + "machineAuditGroupType": { + "id": "TITAN", + "typeName": "Quantum Gold Pro" + }, + "currentStatus": { + "canTopOff": true, + "controlId": "172670157951967236", + "createdAt": "2024-10-27T17:04:05.699000", + "displayStatus": { + "id": "0", + "times": [ + 1000 + ], + "values": [ + " :24" + ] + }, + "gatewayName": "334b35ddd2700be0075c5af0aa247aa9", + "id": "452709", + "isDoorOpen": false, + "linkQualityIndicator": 43, + "microType": 0, + "receivedAt": "2024-10-27T17:04:05.699000", + "remainingSeconds": 1386, + "remainingVend": 0, + "roomId": "14099", + "selectedCycle": { + "id": 4, + "name": "MEDIUM" + }, + "selectedModifier": { + "id": 0 + }, + "statusId": "IN_USE", + "topOffTime": 300, + "topOffVend": 25, + "topoffFullyDisabled": false, + "uuid": "8e510997-b964-4c02-b6f8-61b39536e2bb" + }, + "ordinalValue": 5 + } +] \ No newline at end of file diff --git a/backend/tests/laundry/mock_rooms_requests_14100.json b/backend/tests/laundry/mock_rooms_requests_14100.json new file mode 100644 index 00000000..c96b9089 --- /dev/null +++ b/backend/tests/laundry/mock_rooms_requests_14100.json @@ -0,0 +1,505 @@ +[ + { + "id": "452757", + "room": { + "id": "14100", + "roomName": "Harnwell 12th Floor" + }, + "isDryer": false, + "isActive": true, + "isWasher": true, + "controlId": "148624543026683908", + "createdAt": "2024-07-30T17:52:12.776571", + "createdBy": 2, + "updatedAt": "2024-07-30T17:52:12.776571", + "updatedBy": null, + "isExternal": false, + "machineName": "Machine Node - 35", + "machineType": { + "id": "10", + "isDryer": false, + "isWasher": true, + "typeName": "Frontload Washer" + }, + "modelNumber": "SFNNYRSP116TW01", + "networkNode": "35", + "organization": { + "id": "481806", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "organizationName": "University of Pennsylvania" + }, + "serialNumber": "2402034894", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "machineNumber": "0035", + "machineAuditType": { + "id": "TITAN_T4", + "typeName": "TITAN_T4" + }, + "machineGeneration": null, + "networkController": null, + "machineAuditGroupType": { + "id": "TITAN", + "typeName": "Quantum Gold Pro" + }, + "currentStatus": { + "canTopOff": false, + "controlId": "148624543026683908", + "createdAt": "2024-10-27T16:42:01.195000", + "displayStatus": { + "id": "0", + "times": [ + 1000 + ], + "values": [ + "5tArt " + ] + }, + "gatewayName": "3e9913389cde1a4518a93c2786748328", + "id": "452757", + "isDoorOpen": false, + "linkQualityIndicator": 44, + "microType": 0, + "receivedAt": "2024-10-27T16:42:01.195000", + "remainingSeconds": 1800, + "remainingVend": 0, + "roomId": "14100", + "selectedCycle": { + "id": 3, + "name": "NORMAL_COLD" + }, + "selectedModifier": { + "id": 0, + "name": "LIGHT" + }, + "statusId": "AVAILABLE", + "topOffTime": 0, + "topOffVend": 0, + "topoffFullyDisabled": true, + "uuid": "a56bad9d-935d-485c-a149-155de0a20139" + }, + "ordinalValue": 0 + }, + { + "id": "452756", + "room": { + "id": "14100", + "roomName": "Harnwell 12th Floor" + }, + "isDryer": true, + "isActive": true, + "isWasher": false, + "controlId": "130156424172511236", + "createdAt": "2024-07-30T17:52:10.442788", + "createdBy": 2, + "updatedAt": "2024-07-30T17:52:10.442788", + "updatedBy": null, + "isExternal": false, + "machineName": "Machine Node - 31", + "machineType": { + "id": "20", + "isDryer": true, + "isWasher": false, + "typeName": "Dryer" + }, + "modelNumber": "SDENYRGS176TW01", + "networkNode": "31", + "organization": { + "id": "481806", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "organizationName": "University of Pennsylvania" + }, + "serialNumber": "2303052978", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "machineNumber": "0031", + "machineAuditType": { + "id": "TITAN_T4", + "typeName": "TITAN_T4" + }, + "machineGeneration": null, + "networkController": null, + "machineAuditGroupType": { + "id": "TITAN", + "typeName": "Quantum Gold Pro" + }, + "currentStatus": { + "canTopOff": true, + "controlId": "130156424172511236", + "createdAt": "2024-10-27T17:04:05.650000", + "displayStatus": { + "id": "0", + "times": [ + 1000 + ], + "values": [ + "5tArt " + ] + }, + "gatewayName": "3e9913389cde1a4518a93c2786748328", + "id": "452756", + "isDoorOpen": false, + "linkQualityIndicator": 49, + "microType": 0, + "receivedAt": "2024-10-27T17:04:05.650000", + "remainingSeconds": 3600, + "remainingVend": 0, + "roomId": "14100", + "selectedCycle": { + "id": 4, + "name": "MEDIUM" + }, + "selectedModifier": { + "id": 0 + }, + "statusId": "AVAILABLE", + "topOffTime": 300, + "topOffVend": 25, + "topoffFullyDisabled": false, + "uuid": "02f531bc-dea3-48dd-a42c-e15916940e63" + }, + "ordinalValue": 1 + }, + { + "id": "452766", + "room": { + "id": "14100", + "roomName": "Harnwell 12th Floor" + }, + "isDryer": true, + "isActive": true, + "isWasher": false, + "controlId": "130155998970748932", + "createdAt": "2024-07-30T17:52:18.485909", + "createdBy": 2, + "updatedAt": "2024-07-30T17:52:18.485909", + "updatedBy": null, + "isExternal": false, + "machineName": "Machine Node - 32", + "machineType": { + "id": "20", + "isDryer": true, + "isWasher": false, + "typeName": "Dryer" + }, + "modelNumber": "SDENYRGS176TW01", + "networkNode": "32", + "organization": { + "id": "481806", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "organizationName": "University of Pennsylvania" + }, + "serialNumber": "2303052988", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "machineNumber": "0032", + "machineAuditType": { + "id": "TITAN_T4", + "typeName": "TITAN_T4" + }, + "machineGeneration": null, + "networkController": null, + "machineAuditGroupType": { + "id": "TITAN", + "typeName": "Quantum Gold Pro" + }, + "currentStatus": { + "canTopOff": true, + "controlId": "130155998970748932", + "createdAt": "2024-10-27T17:05:04.327000", + "displayStatus": { + "id": "0", + "times": [ + 1000 + ], + "values": [ + "FrEE " + ] + }, + "gatewayName": "3e9913389cde1a4518a93c2786748328", + "id": "452766", + "isDoorOpen": false, + "linkQualityIndicator": 56, + "microType": 0, + "receivedAt": "2024-10-27T17:05:04.327000", + "remainingSeconds": 3600, + "remainingVend": 0, + "roomId": "14100", + "selectedCycle": { + "id": 4, + "name": "MEDIUM" + }, + "selectedModifier": { + "id": 0 + }, + "statusId": "AVAILABLE", + "topOffTime": 300, + "topOffVend": 25, + "topoffFullyDisabled": false, + "uuid": "d423bd7f-60e0-47e2-b2fd-6c00770d7737" + }, + "ordinalValue": 2 + }, + { + "id": "452763", + "room": { + "id": "14100", + "roomName": "Harnwell 12th Floor" + }, + "isDryer": true, + "isActive": true, + "isWasher": false, + "controlId": "130156978223292420", + "createdAt": "2024-07-30T17:52:17.41128", + "createdBy": 2, + "updatedAt": "2024-07-30T17:52:17.41128", + "updatedBy": null, + "isExternal": false, + "machineName": "Machine Node - 33", + "machineType": { + "id": "20", + "isDryer": true, + "isWasher": false, + "typeName": "Dryer" + }, + "modelNumber": "SDENYRGS176TW01", + "networkNode": "33", + "organization": { + "id": "481806", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "organizationName": "University of Pennsylvania" + }, + "serialNumber": "2303053001", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "machineNumber": "0033", + "machineAuditType": { + "id": "TITAN_T4", + "typeName": "TITAN_T4" + }, + "machineGeneration": null, + "networkController": null, + "machineAuditGroupType": { + "id": "TITAN", + "typeName": "Quantum Gold Pro" + }, + "currentStatus": { + "canTopOff": true, + "controlId": "130156978223292420", + "createdAt": "2024-10-27T16:50:15.737000", + "displayStatus": { + "id": "0", + "times": [ + 1000, + 1000 + ], + "values": [ + "CLo5E", + "door" + ] + }, + "gatewayName": "3e9913389cde1a4518a93c2786748328", + "id": "452763", + "isDoorOpen": false, + "linkQualityIndicator": 45, + "microType": 0, + "receivedAt": "2024-10-27T16:50:15.737000", + "remainingSeconds": 3600, + "remainingVend": 0, + "roomId": "14100", + "selectedCycle": { + "id": 4, + "name": "MEDIUM" + }, + "selectedModifier": { + "id": 0 + }, + "statusId": "AVAILABLE", + "topOffTime": 300, + "topOffVend": 25, + "topoffFullyDisabled": false, + "uuid": "b9955d3e-0b76-4f32-a81f-ce83c005e86c" + }, + "ordinalValue": 3 + }, + { + "id": "452754", + "room": { + "id": "14100", + "roomName": "Harnwell 12th Floor" + }, + "isDryer": false, + "isActive": true, + "isWasher": true, + "controlId": "175240335100911620", + "createdAt": "2024-07-30T17:52:04.528356", + "createdBy": 2, + "updatedAt": "2024-07-30T17:52:04.528356", + "updatedBy": null, + "isExternal": false, + "machineName": "Machine Node - 34", + "machineType": { + "id": "10", + "isDryer": false, + "isWasher": true, + "typeName": "Frontload Washer" + }, + "modelNumber": "SFNNYRSP116TW01", + "networkNode": "34", + "organization": { + "id": "481806", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "organizationName": "University of Pennsylvania" + }, + "serialNumber": "2405043743", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "machineNumber": "0034", + "machineAuditType": { + "id": "TITAN_T4", + "typeName": "TITAN_T4" + }, + "machineGeneration": null, + "networkController": null, + "machineAuditGroupType": { + "id": "TITAN", + "typeName": "Quantum Gold Pro" + }, + "currentStatus": { + "canTopOff": false, + "controlId": "175240335100911620", + "createdAt": "2024-10-27T17:05:03.097000", + "displayStatus": { + "id": "0", + "times": [ + 1000 + ], + "values": [ + " 21" + ] + }, + "gatewayName": "3e9913389cde1a4518a93c2786748328", + "id": "452754", + "isDoorOpen": false, + "linkQualityIndicator": 41, + "microType": 0, + "receivedAt": "2024-10-27T17:05:03.097000", + "remainingSeconds": 1223, + "remainingVend": 0, + "roomId": "14100", + "selectedCycle": { + "id": 3, + "name": "NORMAL_COLD" + }, + "selectedModifier": { + "id": 2, + "name": "HEAVY" + }, + "statusId": "IN_USE", + "topOffTime": 0, + "topOffVend": 0, + "topoffFullyDisabled": true, + "uuid": "5383d36f-042e-4e6c-825d-7c9140dd065e" + }, + "ordinalValue": 4 + }, + { + "id": "452755", + "room": { + "id": "14100", + "roomName": "Harnwell 12th Floor" + }, + "isDryer": false, + "isActive": true, + "isWasher": true, + "controlId": "175240266381434884", + "createdAt": "2024-07-30T17:52:10.297965", + "createdBy": 2, + "updatedAt": "2024-07-30T17:52:10.297965", + "updatedBy": null, + "isExternal": false, + "machineName": "Machine Node - 36", + "machineType": { + "id": "10", + "isDryer": false, + "isWasher": true, + "typeName": "Frontload Washer" + }, + "modelNumber": "SFNNYRSP116TW01", + "networkNode": "36", + "organization": { + "id": "481806", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "organizationName": "University of Pennsylvania" + }, + "serialNumber": "2405043736", + "userRoleType": { + "id": "ORGANIZATION_ROUTE_UNIVERSITY" + }, + "machineNumber": "0036", + "machineAuditType": { + "id": "TITAN_T4", + "typeName": "TITAN_T4" + }, + "machineGeneration": null, + "networkController": null, + "machineAuditGroupType": { + "id": "TITAN", + "typeName": "Quantum Gold Pro" + }, + "currentStatus": { + "canTopOff": false, + "controlId": "175240266381434884", + "createdAt": "2024-10-27T17:02:07.346000", + "displayStatus": { + "id": "0", + "times": [ + 1000 + ], + "values": [ + " :00" + ] + }, + "gatewayName": "3e9913389cde1a4518a93c2786748328", + "id": "452755", + "isDoorOpen": false, + "linkQualityIndicator": 42, + "microType": 0, + "receivedAt": "2024-10-27T17:02:07.346000", + "remainingSeconds": 1800, + "remainingVend": 0, + "roomId": "14100", + "selectedCycle": { + "id": 3, + "name": "NORMAL_COLD" + }, + "selectedModifier": { + "id": 0, + "name": "LIGHT" + }, + "statusId": "COMPLETE", + "topOffTime": 0, + "topOffVend": 0, + "topoffFullyDisabled": true, + "uuid": "f8556ec4-fe2a-47c4-b74b-97045e019165" + }, + "ordinalValue": 5 + } +] \ No newline at end of file diff --git a/backend/tests/laundry/test_commands.py b/backend/tests/laundry/test_commands.py index 79028394..b502c2ac 100644 --- a/backend/tests/laundry/test_commands.py +++ b/backend/tests/laundry/test_commands.py @@ -10,12 +10,19 @@ def fakeLaundryGet(url, *args, **kwargs): - if settings.LAUNDRY_URL in url: - with open("tests/laundry/laundry_snapshot.html", "rb") as f: - m = mock.MagicMock(content=f.read()) - return m - else: - raise NotImplementedError + # TODO: should we do this with regex? using split bc I think it's cleaner + split = url.split("/") + if "/".join(split[0:3]) == settings.LAUNDRY_URL: + if split[3] == "rooms": + with open(f"tests/laundry/mock_rooms_request_{split[4]}.json", "rb") as f: + m = mock.MagicMock(content=f.read()) + return m + elif split[3] == "geoBoundaries": + with open("tests/laundry/mock_geoboundaries_request.json", "rb") as f: + m = mock.MagicMock(content=f.read()) + return m + else: + raise NotImplementedError @mock.patch("requests.get", fakeLaundryGet)