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


##########
traffic_ops/testing/api_contract/v4/test_server_server_capabilities.py:
##########
@@ -0,0 +1,83 @@
+#
+# 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 Server Server Capabilities endpoint."""
+import logging
+from typing import Union
+
+import pytest
+import requests
+from jsonschema import validate
+
+from trafficops.tosession import TOSession
+
+# Create and configure logger
+logger = logging.getLogger()
+
+Primitive = Union[bool, int, float, str, None]
+
+
+def test_server_server_capabilities_contract(
+       to_session: TOSession,
+       response_template_data: dict[str, Union[Primitive, 
list[Union[Primitive, dict[str, object],
+       list[object]]], dict[object, object]]], 
server_server_capabilities_post_data: dict[str, object]) -> None:
+       """
+       Test step to validate keys, values and data types from server server 
capabilities endpoint
+       response.
+       :param to_session: Fixture to get Traffic Ops session.
+       :param response_template_data: Fixture to get response template data 
from a prerequisites file.
+       :param server_server_capabilities_post_data: Fixture to get sample 
server server capabilities data 
+       and actual Server Server Capabilities response.
+       """
+       # validate Server Server Capabilities keys from server server 
capabilities get response
+       logger.info(
+               "Accessing /server server capabilities endpoint through Traffic 
ops session.")
+
+       server_id = server_server_capabilities_post_data.get("serverId")
+       if not isinstance(server_id, int):
+               raise TypeError(
+                       "malformed server server capabilities in prerequisite 
data; 'serverId' not an integer")
+
+       server_server_capabilities_get_response: tuple[
+               Union[dict[str, object],

Review Comment:
   please check spaces. 



##########
traffic_control/clients/python/trafficops/tosession.py:
##########
@@ -1522,6 +1522,38 @@ def delete_multiple_servers_capabilities(self, 
data=None):
                :raises: Union[LoginError, OperationError]
                """
 
+       #
+       # Server_server_capabilities
+       #
+       @api_request('get', 'server_server_capabilities', ('3.0', '4.0', '4.1', 
'5.0'))
+       def get_server_server_capabilities(self, query_params=none):

Review Comment:
   query_params=none: check language syntax: -> None
   
   
    



##########
traffic_control/clients/python/trafficops/tosession.py:
##########
@@ -1522,6 +1522,38 @@ def delete_multiple_servers_capabilities(self, 
data=None):
                :raises: Union[LoginError, OperationError]
                """
 
+       #
+       # Server_server_capabilities
+       #
+       @api_request('get', 'server_server_capabilities', ('3.0', '4.0', '4.1', 
'5.0'))
+       def get_server_server_capabilities(self, query_params=none):
+               """
+               Gets all associations of Server Capabilities to cache servers.
+               :ref:`to-api-server_server_capabilities`
+               :rtype: Tuple[Dict[str, Any], requests.Response]
+               :raises: Union[LoginError, OperationError]
+               """
+
+
+       @api_request('post', 'server_server_capabilities', ('3.0', '4.0', 
'4.1', '5.0'))
+       def associate_server_capability_to_server(self, data=None):
+               """
+               Associate server capability to server.

Review Comment:
   missing annotation for data param 
   `:param data: The parameter data to .......... `
   :type data: Dict[str, Any] 



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