From 29412eb383e6be93634e28c61f998a60e1105850 Mon Sep 17 00:00:00 2001 From: jfm Date: Thu, 2 May 2024 12:37:16 +0200 Subject: [PATCH] Trace logging --- src/mastodon/timelines.py | 4 ++-- tests/test_timelines.py | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/mastodon/timelines.py b/src/mastodon/timelines.py index ba6bd05..7191f13 100644 --- a/src/mastodon/timelines.py +++ b/src/mastodon/timelines.py @@ -9,7 +9,7 @@ class Timelines(): self.config = configuration self.auth = authorization - def home_timeline(self, min_id=None, max_id=None, since_id=None, limit=None): + def home(self, min_id=None, max_id=None, since_id=None, limit=None): url = "https://"+self.config.get_value("server")+"/api/v1/timelines/home" parameters = dict() @@ -23,5 +23,5 @@ class Timelines(): parameters["limit"] = limit response = requests.get(url, headers=self.auth.get_auth_headers(), params=parameters) - logger.debug("JSON: {}".format(response.raw)) + logger.trace("JSON: {}".format(str(response.content))) return response.json() diff --git a/tests/test_timelines.py b/tests/test_timelines.py index ba7a240..50f658e 100644 --- a/tests/test_timelines.py +++ b/tests/test_timelines.py @@ -15,7 +15,7 @@ def app(): @responses.activate def test_home_timeline(app): responses.get("https://social.example.com/api/v1/timelines/home", json=json_reader("./tests/resources/timeline_home_response.json")) - response = app.timelines.home_timeline() + response = app.timelines.home() assert response is not None statuses = [] for status in response: @@ -31,7 +31,7 @@ def test_home_timeline_max_id(app): responses.get("https://social.example.com/api/v1/timelines/home", json=json_reader("./tests/resources/timeline_home_response.json"), match=[matchers.query_param_matcher(params)]) - response = app.timelines.home_timeline(max_id="1") + response = app.timelines.home(max_id="1") assert response is not None statuses = [] for status in response: @@ -47,7 +47,7 @@ def test_home_timeline_min_id(app): responses.get("https://social.example.com/api/v1/timelines/home", json=json_reader("./tests/resources/timeline_home_response.json"), match=[matchers.query_param_matcher(params)]) - response = app.timelines.home_timeline(min_id="1") + response = app.timelines.home(min_id="1") assert response is not None statuses = [] for status in response: @@ -63,7 +63,7 @@ def test_home_timeline_since_id(app): responses.get("https://social.example.com/api/v1/timelines/home", json=json_reader("./tests/resources/timeline_home_response.json"), match=[matchers.query_param_matcher(params)]) - response = app.timelines.home_timeline(since_id="1") + response = app.timelines.home(since_id="1") assert response is not None statuses = [] for status in response: @@ -79,7 +79,7 @@ def test_home_timeline_limt(app): responses.get("https://social.example.com/api/v1/timelines/home", json=json_reader("./tests/resources/timeline_home_response.json"), match=[matchers.query_param_matcher(params)]) - response = app.timelines.home_timeline(limit="1") + response = app.timelines.home(limit="1") assert response is not None statuses = [] for status in response: @@ -93,5 +93,3 @@ def test_home_timeline_limt(app): def json_reader(path): with open(path) as f: return json.load(f) - -#match=[matchers.query_param_matcher(params)],