From bf87f5a2384c2b774c0b73f404995e106662554b Mon Sep 17 00:00:00 2001 From: MJedr Date: Thu, 5 Oct 2023 15:53:31 +0200 Subject: [PATCH] add missing cassette --- Library-Notification-Service/LICENSE | 2 +- Library-Notification-Service/src/api.py | 8 +- Library-Notification-Service/src/utils.py | 4 +- .../cassettes/test_cli_default_arguments.yaml | 90 +++++++++++++++++++ 4 files changed, 97 insertions(+), 7 deletions(-) create mode 100644 matomo-api/tests/cassettes/test_cli_default_arguments.yaml diff --git a/Library-Notification-Service/LICENSE b/Library-Notification-Service/LICENSE index ec1822a..851c682 100644 --- a/Library-Notification-Service/LICENSE +++ b/Library-Notification-Service/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 CERN Scientific Information Service +Copyright (c) 2023 CERN Scientific Information Service Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Library-Notification-Service/src/api.py b/Library-Notification-Service/src/api.py index 6e1b25a..d1506f5 100644 --- a/Library-Notification-Service/src/api.py +++ b/Library-Notification-Service/src/api.py @@ -2,15 +2,15 @@ import json -from typing import List import urllib.parse +from typing import List import requests from .env import ( - LIBRARY_CATALOGUE_BACKOFFICE_ITEMS_API, - LIBRARY_CATALOGUE_BACKOFFICE_EITEMS_API, LIBRARY_CATALOGUE_BACKOFFICE_API_TOKEN, + LIBRARY_CATALOGUE_BACKOFFICE_EITEMS_API, + LIBRARY_CATALOGUE_BACKOFFICE_ITEMS_API, LIBRARY_CATALOGUE_SITE_API, NOTIFICATIONS_API_SECRET, NOTIFICATIONS_API_URL, @@ -18,8 +18,8 @@ ) from .utils import ( get_full_query, - get_last_week_date_range, get_last_five_years_range, + get_last_week_date_range, get_pids_from_docs, ) diff --git a/Library-Notification-Service/src/utils.py b/Library-Notification-Service/src/utils.py index 8bece3d..4cf2b26 100644 --- a/Library-Notification-Service/src/utils.py +++ b/Library-Notification-Service/src/utils.py @@ -1,8 +1,8 @@ """Module containing methods related to query generator.""" -from datetime import datetime, timedelta import urllib.parse -from typing import Optional, List +from datetime import datetime, timedelta +from typing import List, Optional from .env import LIBRARY_CATALOGUE_SITE_URL diff --git a/matomo-api/tests/cassettes/test_cli_default_arguments.yaml b/matomo-api/tests/cassettes/test_cli_default_arguments.yaml new file mode 100644 index 0000000..51da986 --- /dev/null +++ b/matomo-api/tests/cassettes/test_cli_default_arguments.yaml @@ -0,0 +1,90 @@ +interactions: +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.31.0 + method: GET + uri: https://webanalytics.web.cern.ch/index.php?date=2023-01-04+00%3A10%3A00&format=json&method=VisitsSummary.getVisits&module=API&period=day + response: + body: + string: '{"value":24}' + headers: + access-control-allow-credentials: + - 'false' + access-control-allow-origin: + - '*' + cache-control: + - must-revalidate + - private + content-length: + - '12' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 05 Oct 2023 13:49:49 GMT + server: + - Apache/2.4.57 (Debian) + set-cookie: + - d63becdd54bbddc0aa193e4f140940ae=59b5ec39d39574dd892a40073505fa96; path=/; + HttpOnly; Secure; SameSite=None + vary: + - Origin + x-matomo-request-id: + - d4116 + x-powered-by: + - PHP/8.1.23 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - python-requests/2.31.0 + method: GET + uri: https://webanalytics.web.cern.ch/index.php?date=2023-01-04+00%3A10%3A00&format=json&method=VisitsSummary.getVisits&module=API&period=day + response: + body: + string: '{"value":24}' + headers: + access-control-allow-credentials: + - 'false' + access-control-allow-origin: + - '*' + cache-control: + - must-revalidate + - private + content-length: + - '12' + content-type: + - application/json; charset=utf-8 + date: + - Thu, 05 Oct 2023 13:49:49 GMT + server: + - Apache/2.4.57 (Debian) + set-cookie: + - d63becdd54bbddc0aa193e4f140940ae=59b5ec39d39574dd892a40073505fa96; path=/; + HttpOnly; Secure; SameSite=None + vary: + - Origin + x-matomo-request-id: + - 8fa2e + x-powered-by: + - PHP/8.1.23 + status: + code: 200 + message: OK +version: 1