TerekhovaKate commented on code in PR #7424:
URL: https://github.com/apache/trafficcontrol/pull/7424#discussion_r1156081997


##########
traffic_ops/testing/api_contract/v4/conftest.py:
##########
@@ -293,18 +300,81 @@ def to_login(to_args: ArgsType) -> TOSession:
        return to_session
 
 
[email protected](name="request_template_data", scope="session")
+def request_prerequiste_data(pytestconfig: pytest.Config, request: 
pytest.FixtureRequest
+                         ) -> list[dict[str, object] | list[object] | 
primitive]:
+       """
+       PyTest Fixture to store POST request template data for api endpoint.
+       :param pytestconfig: Session-scoped fixture that returns the session's 
pytest.Config object.
+       :param request: Fixture to access information about the requesting test 
function and its fixtures
+
+       :returns: Prerequisite request data for api endpoint.
+       """
+       request_template_path = pytestconfig.getoption("--request-template")
+       if not isinstance(request_template_path, str):
+               # unlike the configuration file, this must be present
+               raise ValueError("prereqisites path not configured")
+
+       # Response keys for api endpoint
+       data: dict[
+               str,
+               list[dict[str, object] | list[object] | primitive] |\
+                       dict[object, object] |\
+                       primitive
+               ] |\
+       primitive = None
+       with open(request_template_path, encoding="utf-8", mode="r") as 
prereq_file:

Review Comment:
   how reusable request_template and response_template json file would be in 
test ?
   if you are planning to use them this data in multiple tests, please create 
reusable test fixture
   



-- 
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]

Reply via email to