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


##########
traffic_ops/testing/api_contract/v4/test_cdns.py:
##########
@@ -98,17 +64,25 @@ def test_cdn_contract(
                cdn_keys = set(first_cdn.keys())
 
                logger.info("CDN Keys from cdns endpoint response %s", cdn_keys)
+               response_template = 
response_template_data.get("cdns").get("properties")
                # validate cdn values from prereq data in cdns get response.
                prereq_values = [
                        cdn_post_data["name"],
                        cdn_post_data["domainName"],
                        cdn_post_data["dnssecEnabled"]
                ]
                get_values = [first_cdn["name"], first_cdn["domainName"], 
first_cdn["dnssecEnabled"]]
-               # validate data types for values from cdn get json response.
-               for (prereq_value, get_value) in zip(prereq_values, get_values):
-                       assert isinstance(prereq_value, type(get_value))
-               assert cdn_keys == set(cdn_post_data.keys())
+               get_types = {}
+               for key in first_cdn:
+                       get_types[key] = type(first_cdn[key]).__name__
+               logger.info("types from cdn get response %s", get_types)
+               response_template_types= {}
+               for key in response_template:
+                       response_template_types[key] = 
response_template.get(key).get("type")
+               logger.info("types from cdn response template %s", 
response_template_types)
+
+               assert cdn_keys == set(response_template.keys())
+               assert dict(sorted(get_types.items())) == 
dict(sorted(response_template_types.items()))
                assert get_values == prereq_values
        except IndexError:
                logger.error("Either prerequisite data or API response was 
malformed")

Review Comment:
   I see. Thnaks 



-- 
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: issues-unsubscr...@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to