Trace logging
Build and Release / run-terraform (push) Successful in 42s Details

This commit is contained in:
jfm 2024-05-02 12:37:16 +02:00
parent 4e3894198d
commit 29412eb383
2 changed files with 7 additions and 9 deletions

View File

@ -9,7 +9,7 @@ class Timelines():
self.config = configuration self.config = configuration
self.auth = authorization 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" url = "https://"+self.config.get_value("server")+"/api/v1/timelines/home"
parameters = dict() parameters = dict()
@ -23,5 +23,5 @@ class Timelines():
parameters["limit"] = limit parameters["limit"] = limit
response = requests.get(url, headers=self.auth.get_auth_headers(), params=parameters) 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() return response.json()

View File

@ -15,7 +15,7 @@ def app():
@responses.activate @responses.activate
def test_home_timeline(app): def test_home_timeline(app):
responses.get("https://social.example.com/api/v1/timelines/home", json=json_reader("./tests/resources/timeline_home_response.json")) 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 assert response is not None
statuses = [] statuses = []
for status in response: 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", responses.get("https://social.example.com/api/v1/timelines/home",
json=json_reader("./tests/resources/timeline_home_response.json"), json=json_reader("./tests/resources/timeline_home_response.json"),
match=[matchers.query_param_matcher(params)]) 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 assert response is not None
statuses = [] statuses = []
for status in response: 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", responses.get("https://social.example.com/api/v1/timelines/home",
json=json_reader("./tests/resources/timeline_home_response.json"), json=json_reader("./tests/resources/timeline_home_response.json"),
match=[matchers.query_param_matcher(params)]) 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 assert response is not None
statuses = [] statuses = []
for status in response: 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", responses.get("https://social.example.com/api/v1/timelines/home",
json=json_reader("./tests/resources/timeline_home_response.json"), json=json_reader("./tests/resources/timeline_home_response.json"),
match=[matchers.query_param_matcher(params)]) 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 assert response is not None
statuses = [] statuses = []
for status in response: for status in response:
@ -79,7 +79,7 @@ def test_home_timeline_limt(app):
responses.get("https://social.example.com/api/v1/timelines/home", responses.get("https://social.example.com/api/v1/timelines/home",
json=json_reader("./tests/resources/timeline_home_response.json"), json=json_reader("./tests/resources/timeline_home_response.json"),
match=[matchers.query_param_matcher(params)]) match=[matchers.query_param_matcher(params)])
response = app.timelines.home_timeline(limit="1") response = app.timelines.home(limit="1")
assert response is not None assert response is not None
statuses = [] statuses = []
for status in response: for status in response:
@ -93,5 +93,3 @@ def test_home_timeline_limt(app):
def json_reader(path): def json_reader(path):
with open(path) as f: with open(path) as f:
return json.load(f) return json.load(f)
#match=[matchers.query_param_matcher(params)],