ericholguin commented on code in PR #7443:
URL: https://github.com/apache/trafficcontrol/pull/7443#discussion_r1165803820
##########
traffic_ops/testing/api_contract/v4/conftest.py:
##########
@@ -471,3 +471,52 @@ def cachegroup_post_data(to_session: TOSession,
request_template_data: list[JSON
except IndexError:
logger.error("No Cache group response data from cdns POST
request.")
sys.exit(1)
+
+
[email protected]()
+def role_post_data(to_session: TOSession, request_template_data: list[JSONData]
+ ) -> dict[str, object]:
+ """
+ PyTest Fixture to create POST data for roles endpoint.
+
+ :param to_session: Fixture to get Traffic Ops session.
+ :param api_prerequisite_data: Fixture to get role data from a
prerequisites file.
Review Comment:
should be `request_template_data` not `api_prerequisite_data`
##########
traffic_ops/testing/api_contract/v4/test_roles.py:
##########
@@ -0,0 +1,112 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+"""API Contract Test Case for roles endpoint."""
+import logging
+import pytest
+import requests
+
+from trafficops.tosession import TOSession
+
+# Create and configure logger
+logger = logging.getLogger()
+
+primitive = bool | int | float | str | None
+
[email protected]('request_template_data', ["roles"], indirect=True)
+def test_role_contract(
+ to_session: TOSession,
+ request_template_data: list[dict[str, object] | list[object] |
primitive],
+ response_template_data: dict[str, primitive | list[primitive |
dict[str, object]
+ | list[object]] |
dict[object, object]],
+ role_post_data: dict[str, object]
+) -> None:
+ """
+ Test step to validate keys, values and data types from roles endpoint
+ response.
+ :param to_session: Fixture to get Traffic Ops session.
+ :param request_template_data: Fixture to get role data from a
prerequisites file.
Review Comment:
missing response_template_data
--
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]