Quellcode durchsuchen

Fix test failures from service registration refactor

- test_calc: parametrize from services() so disabled services are excluded
- refresh-all.ts: remove homestay (disabled); Booking stale session already handled as exit 1
- config-all.json: regenerate after field rename
ZiB vor 4 Monaten
Ursprung
Commit
cfc074bbd9

+ 21 - 8
room_cal/config-all.json

@@ -84,12 +84,11 @@
   "services": {
     "airbnb": {
       "name": "AirBnB",
-      "listing_id": "",
-      "hotel_id": "",
-      "hotel_account_id": "",
-      "host_account_id": "",
       "room_id": "",
+      "account_id": "",
+      "hotel_id": "",
       "rate_id": "",
+      "disabled": false,
       "fees": {
         "commission": 0.03,
         "client_fee": 0.1411235955
@@ -100,12 +99,11 @@
     },
     "booking": {
       "name": "Booking.com",
-      "listing_id": "",
-      "hotel_id": "",
-      "hotel_account_id": "",
-      "host_account_id": "",
       "room_id": "",
+      "account_id": "",
+      "hotel_id": "",
       "rate_id": "",
+      "disabled": false,
       "fees": {
         "commission": 0.15,
         "client_fee": 0.0
@@ -114,6 +112,21 @@
         "wrong": 0.145,
         "flat_tax": 0
       }
+    },
+    "homestay": {
+      "name": "Homestay",
+      "room_id": "",
+      "account_id": "",
+      "hotel_id": "",
+      "rate_id": "",
+      "disabled": true,
+      "fees": {
+        "commission": 0.0,
+        "client_fee": 0.16
+      },
+      "taxes": {
+        "flat_tax": 0
+      }
     }
   },
   "calendars": [

+ 2 - 4
room_cal/service_api/typescript/scripts/refresh-all.ts

@@ -1,6 +1,6 @@
 import { refresh as refreshAirbnb } from '../airbnb/refresh-cookies';
 import { refresh as refreshBooking } from '../booking/refresh-cookies';
-import { refresh as refreshHomestay } from '../homestay/refresh-cookies';
+// import { refresh as refreshHomestay } from '../homestay/refresh-cookies';  // disabled
 import { handleOutput } from '../shared/api-client';
 import { parseOutputMode } from '../shared/cookie-utils';
 import * as path from 'path';
@@ -10,15 +10,13 @@ const DATA_HOME = process.env.ROOM_CAL_DATA_HOME ?? path.join(os.homedir(), '.lo
 const mode = parseOutputMode(process.argv);
 
 async function main(): Promise<void> {
-  const [airbnbCreds, bookingCreds, homestayCreds] = await Promise.all([
+  const [airbnbCreds, bookingCreds] = await Promise.all([
     refreshAirbnb(mode),
     refreshBooking(mode),
-    refreshHomestay(mode),
   ]);
   await Promise.all([
     handleOutput('airbnb', airbnbCreds, mode, path.join(DATA_HOME, 'airbnb.env')),
     handleOutput('booking', bookingCreds, mode, path.join(DATA_HOME, 'booking.env')),
-    handleOutput('homestay', homestayCreds, mode, path.join(DATA_HOME, 'homestay.env')),
   ]);
   if (mode !== 'stdout') console.error('\nAll credentials refreshed.');
 }

+ 2 - 2
tests/test_calc.py

@@ -1,5 +1,5 @@
 import pytest
-from room_cal._utils import get_config
+from room_cal._utils import services as _services_list
 from room_cal.pricing.calc import (
   net_to_list,
   list_to_net,
@@ -9,7 +9,7 @@ from room_cal.pricing.calc import (
   retail_to_net,
 )
 
-_SERVICES = list(get_config().services.keys())
+_SERVICES = [s.key for s in _services_list()]
 _NET = 100.0