Kashatlast2 commented on code in PR #7788:
URL: https://github.com/apache/trafficcontrol/pull/7788#discussion_r1324817708
##########
traffic_ops/testing/api_contract/v4/conftest.py:
##########
@@ -1945,3 +1945,23 @@ def server_server_capabilities_data_post(to_session:
TOSession, edge_type_data:N
if msg is None:
logger.error("Server Server Capability returned by Traffic Ops
is missing a 'server_id' property")
pytest.fail("Response from delete request is empty, Failing
test_case")
+
+
[email protected](name="logs_data")
+def logs_data(to_session: TOSession, request_template_data: list[JSONData],
+ ) -> dict[str, object]:
+ """
+ PyTest Fixture to retrieve log data from logs endpoint.
+ :param to_session: Fixture to get Traffic Ops session.
+ :returns: Log data obtained from logs endpoint.
+ """
+
+ change_logs = check_template_data(request_template_data["logs"], "logs")
+
+
+ # Hitting logs GET methed
+ response: tuple[JSONData, requests.Response] =
to_session.get_change_logs(data=change_logs)
Review Comment:
There is no POST Request available. And when I tried to create it. It was
telling me that the endpoint doesn't exist. Same for in Postman.
I was getting
`self = <trafficops.tosession.TOSession object at 0x107365790>, operation =
'post', api_path = 'logs', query_params = None, munchify = True
debug_response = False, expected_status_codes = range(200, 300), unused_args
= ()
kwargs = {'data': {'id': 444, 'level': 'APICHANGE', 'message': 'log for test
purposes', 'ticketNum': None, ...}}
msg = 'POST request to RESTful API at
[https://tp.staging.cdnlab.comcast.net:443/api/4.0/logs] expected status(s)
range(200,...nd; Response: {\'alerts\': [{\'text\': "The requested path
\'/api/4.0/logs\' does not exist.", \'level\': \'error\'}]}'
response = <Response [404]>, retdata = {'alerts': [{'level': 'error',
'text': "The requested path '/api/4.0/logs' does not exist."}]}
endpoint = 'https://tp.staging.cdnlab.comcast.net:443/api/4.0/logs'
params = {'data': '{"ticketNum": null, "level": "APICHANGE", "user":
"admin", "id": 444, "message": "log for test purposes"}', 'headers':
{'Content-Type': 'application/json; charset=UTF-8'}, 'verify': False}`
GET to the same endpoint works fine so I thought I had to modify for GET for
this one as it wasn't accepting POST requests.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]