Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore nonzero nanoseconds warning #360

Merged
merged 16 commits into from
Aug 17, 2023
4 changes: 2 additions & 2 deletions docs/APILibraryDocumentation.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/GUILibraryDocumentation.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/SOAPLibraryDocumentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="-1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="Robot Framework 6.1 (Python 3.10.6 on win32)" name="Generator">
<meta content="Robot Framework 6.1.1 (Python 3.10.6 on win32)" name="Generator">
<link rel="icon" type="image/x-icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKcAAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAAqAAAAAAAAAAAAAAAAAAAALIAAAD/AAAA4AAAANwAAADcAAAA3AAAANwAAADcAAAA3AAAANwAAADcAAAA4AAAAP8AAACxAAAAAAAAAKYAAAD/AAAAuwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC/AAAA/wAAAKkAAAD6AAAAzAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAN8AAAD/AAAA+gAAAMMAAAAAAAAAAgAAAGsAAABrAAAAawAAAGsAAABrAAAAawAAAGsAAABrAAAADAAAAAAAAADaAAAA/wAAAPoAAADDAAAAAAAAAIsAAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAANEAAAAAAAAA2gAAAP8AAAD6AAAAwwAAAAAAAAAAAAAAMgAAADIAAAAyAAAAMgAAADIAAAAyAAAAMgAAADIAAAAFAAAAAAAAANoAAAD/AAAA+gAAAMMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADaAAAA/wAAAPoAAADDAAAAAAAAADwAAAB8AAAAAAAAAGAAAABcAAAAAAAAAH8AAABKAAAAAAAAAAAAAAAAAAAA2gAAAP8AAAD6AAAAwwAAAAAAAADCAAAA/wAAACkAAADqAAAA4QAAAAAAAAD7AAAA/wAAALAAAAAGAAAAAAAAANoAAAD/AAAA+gAAAMMAAAAAAAAAIwAAAP4AAAD/AAAA/wAAAGAAAAAAAAAAAAAAAMkAAAD/AAAAigAAAAAAAADaAAAA/wAAAPoAAADDAAAAAAAAAAAAAAAIAAAAcAAAABkAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAAAAAAA2gAAAP8AAAD7AAAAywAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAN4AAAD/AAAAqwAAAP8AAACvAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALIAAAD/AAAAsgAAAAAAAAC5AAAA/wAAAMoAAADAAAAAwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAMkAAAD/AAAAvAAAAAAAAAAAAAAAAAAAAKwAAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAArQAAAAAAAAAAwAMAAIABAAAf+AAAP/wAAD/8AAAgBAAAP/wAAD/8AAA//AAAJIwAADHEAAA//AAAP/wAAB/4AACAAQAAwAMAAA==">
<style media="all" type="text/css">
:root {
Expand Down Expand Up @@ -1180,7 +1180,7 @@
jQuery.extend({highlight:function(e,t,n,r){if(e.nodeType===3){var i=e.data.match(t);if(i){var s=document.createElement(n||"span");s.className=r||"highlight";var o=e.splitText(i.index);o.splitText(i[0].length);var u=o.cloneNode(true);s.appendChild(u);o.parentNode.replaceChild(s,o);return 1}}else if(e.nodeType===1&&e.childNodes&&!/(script|style)/i.test(e.tagName)&&!(e.tagName===n.toUpperCase()&&e.className===r)){for(var a=0;a<e.childNodes.length;a++){a+=jQuery.highlight(e.childNodes[a],t,n,r)}}return 0}});jQuery.fn.unhighlight=function(e){var t={className:"highlight",element:"span"};jQuery.extend(t,e);return this.find(t.element+"."+t.className).each(function(){var e=this.parentNode;e.replaceChild(this.firstChild,this);e.normalize()}).end()};jQuery.fn.highlight=function(e,t){var n={className:"highlight",element:"span",caseSensitive:false,wordsOnly:false};jQuery.extend(n,t);if(e.constructor===String){e=[e]}e=jQuery.grep(e,function(e,t){return e!=""});e=jQuery.map(e,function(e,t){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")});if(e.length==0){return this}var r=n.caseSensitive?"":"i";var i="("+e.join("|")+")";if(n.wordsOnly){i="\\b"+i+"\\b"}var s=new RegExp(i,r);return this.each(function(){jQuery.highlight(this,s,n.element,n.className)})}
</script>
<script type="text/javascript">
libdoc = {"specversion": 2, "name": "SOAP_Library", "doc": "<p>Zoomba SOAP Library</p>\n<p>This class is the base Library used to generate automated SOAP Tests in the Zoomba Automation Framework.</p>", "version": "3.5.0", "generated": "2023-07-14T19:00:44+00:00", "type": "LIBRARY", "scope": "TEST", "docFormat": "HTML", "source": "C:\\Git\\robotframework-zoomba\\src\\Zoomba\\SOAPLibrary.py", "lineno": 43, "tags": [], "inits": [], "keywords": [{"name": "Call Soap Method With List Object", "args": [{"name": "action", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "action=None"}, {"name": "soap_object", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "soap_object=None"}], "doc": "<p>Call Soap Method. Calls soap method with list object</p>\n<p>action: (string) SOAP Action to be called.</p>\n<p>soap_object: (list) Soap Object in list format, list must be ordered wrt schema</p>", "shortdoc": "Call Soap Method. Calls soap method with list object ", "tags": [], "source": "C:\\Git\\robotframework-zoomba\\src\\Zoomba\\SOAPLibrary.py", "lineno": 100}, {"name": "Call Soap Method With Object", "args": [{"name": "action", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "action=None"}, {"name": "soap_object", "type": null, "types": [], "typedocs": {}, "defaultValue": null, "kind": "VAR_NAMED", "required": false, "repr": "**soap_object"}], "doc": "<p>Call Soap Method with dictionary object. Calls soap method</p>\n<p>action: (string) SOAP Action to be called.</p>\n<p>soap_object: (dict) Soap Object in dict format, dict must contain all required parts of schema object.</p>", "shortdoc": "Call Soap Method with dictionary object. Calls soap method ", "tags": [], "source": "C:\\Git\\robotframework-zoomba\\src\\Zoomba\\SOAPLibrary.py", "lineno": 109}, {"name": "Convert Soap Response To Json", "args": [{"name": "soap_response", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "soap_response=None"}], "doc": "<p>Convert Soap Response To Dictionary: This keyword builds a dictionary from the sudsLibrary response</p>\n<p>json_actual_response: (request response object) The response from an API.</p>\n<p>return: There is no actual returned output, other than error messages when comparisons fail.</p>", "shortdoc": "Convert Soap Response To Dictionary: This keyword builds a dictionary from the sudsLibrary response", "tags": [], "source": "C:\\Git\\robotframework-zoomba\\src\\Zoomba\\SOAPLibrary.py", "lineno": 138}, {"name": "Create Soap Session", "args": [{"name": "host", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "host=None"}, {"name": "endpoint", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "endpoint=None"}, {"name": "alias", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "alias=None"}, {"name": "kwargs", "type": null, "types": [], "typedocs": {}, "defaultValue": null, "kind": "VAR_NAMED", "required": false, "repr": "**kwargs"}], "doc": "<p>Create Soap Session. This Keyword utilizes the WSDL to create a soap client.</p>\n<p>host: (string) The host url.</p>\n<p>endpoint: (string) SOAP API endpoint containing the actions to be referenced.</p>\n<p>**kwargs: (optional) Parameters that could be included to add options to client creation. Current supported parameters are:</p>\n<p>set_location: http address</p>", "shortdoc": "Create Soap Session. This Keyword utilizes the WSDL to create a soap client.", "tags": [], "source": "C:\\Git\\robotframework-zoomba\\src\\Zoomba\\SOAPLibrary.py", "lineno": 68}, {"name": "Create Soap Session And Fix Wsdl", "args": [{"name": "host", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "host=None"}, {"name": "endpoint", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "endpoint=None"}, {"name": "alias", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "alias=None"}, {"name": "kwargs", "type": null, "types": [], "typedocs": {}, "defaultValue": null, "kind": "VAR_NAMED", "required": false, "repr": "**kwargs"}], "doc": "<p>Create Soap Session. This Keyword utilizes the WSDL and directly accesses calls from sudsLibrary.</p>\n<p>host: (string) The host url.</p>\n<p>endpoint: (string) SOAP API endpoint containing the actions to be referenced.</p>\n<p>alias: (string} Sets the alias for the SudsLibrary Framework **kwargs: (optional) Parameters that could be included to add options to client creation. Current supported parameters are:</p>\n<p>set_location: http address</p>", "shortdoc": "Create Soap Session. This Keyword utilizes the WSDL and directly accesses calls from sudsLibrary.", "tags": [], "source": "C:\\Git\\robotframework-zoomba\\src\\Zoomba\\SOAPLibrary.py", "lineno": 51}, {"name": "Create Soap Session And Set Location", "args": [{"name": "host", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "host=None"}, {"name": "endpoint", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "endpoint=None"}, {"name": "alias", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "alias=None"}, {"name": "set_location", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "set_location=None"}, {"name": "fix", "type": null, "types": [], "typedocs": {}, "defaultValue": "False", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "fix=False"}], "doc": "<p>Create Soap Session and Set Location. In addition to the client creation, this keyword sets the location as specified.</p>\n<p>host: (string) The host url.</p>\n<p>endpoint: (string) SOAP API endpoint containing the actions to be referenced.</p>\n<p>set_location: (string) If set will overwrite the WSDL location with specified address.</p>\n<p>If set to None will replace location with host and endpoint specified</p>", "shortdoc": "Create Soap Session and Set Location. In addition to the client creation, this keyword sets the location as specified.", "tags": [], "source": "C:\\Git\\robotframework-zoomba\\src\\Zoomba\\SOAPLibrary.py", "lineno": 84}, {"name": "Create Wsdl Objects", "args": [{"name": "wsdl_type", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "wsdl_type=None"}, {"name": "object_dict", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "object_dict=None"}], "doc": "<p>Create Wsdl Objects. This Keyword utilizes the WSDL to create a WSDL object based on the information provided.</p>\n<p>wsdl_type: (string) Wsdl object to be created.</p>\n<p>object_dict: (dict) Python Dictionary containing values and nested dictionaries with construction similar to wsdl defined objects.</p>\n<p>return: (response object) Returns the SOAP client object.</p>", "shortdoc": "Create Wsdl Objects. This Keyword utilizes the WSDL to create a WSDL object based on the information provided.", "tags": [], "source": "C:\\Git\\robotframework-zoomba\\src\\Zoomba\\SOAPLibrary.py", "lineno": 124}], "dataTypes": {"enums": [], "typedDicts": []}, "typedocs": []}
libdoc = {"specversion": 2, "name": "SOAP_Library", "doc": "<p>Zoomba SOAP Library</p>\n<p>This class is the base Library used to generate automated SOAP Tests in the Zoomba Automation Framework.</p>", "version": "3.6.0", "generated": "2023-08-16T20:36:06+00:00", "type": "LIBRARY", "scope": "TEST", "docFormat": "HTML", "source": "C:\\Git\\robotframework-zoomba\\src\\Zoomba\\SOAPLibrary.py", "lineno": 43, "tags": [], "inits": [], "keywords": [{"name": "Call Soap Method With List Object", "args": [{"name": "action", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "action=None"}, {"name": "soap_object", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "soap_object=None"}], "doc": "<p>Call Soap Method. Calls soap method with list object</p>\n<p>action: (string) SOAP Action to be called.</p>\n<p>soap_object: (list) Soap Object in list format, list must be ordered wrt schema</p>", "shortdoc": "Call Soap Method. Calls soap method with list object ", "tags": [], "source": "C:\\Git\\robotframework-zoomba\\src\\Zoomba\\SOAPLibrary.py", "lineno": 100}, {"name": "Call Soap Method With Object", "args": [{"name": "action", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "action=None"}, {"name": "soap_object", "type": null, "types": [], "typedocs": {}, "defaultValue": null, "kind": "VAR_NAMED", "required": false, "repr": "**soap_object"}], "doc": "<p>Call Soap Method with dictionary object. Calls soap method</p>\n<p>action: (string) SOAP Action to be called.</p>\n<p>soap_object: (dict) Soap Object in dict format, dict must contain all required parts of schema object.</p>", "shortdoc": "Call Soap Method with dictionary object. Calls soap method ", "tags": [], "source": "C:\\Git\\robotframework-zoomba\\src\\Zoomba\\SOAPLibrary.py", "lineno": 109}, {"name": "Convert Soap Response To Json", "args": [{"name": "soap_response", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "soap_response=None"}], "doc": "<p>Convert Soap Response To Dictionary: This keyword builds a dictionary from the sudsLibrary response</p>\n<p>json_actual_response: (request response object) The response from an API.</p>\n<p>return: There is no actual returned output, other than error messages when comparisons fail.</p>", "shortdoc": "Convert Soap Response To Dictionary: This keyword builds a dictionary from the sudsLibrary response", "tags": [], "source": "C:\\Git\\robotframework-zoomba\\src\\Zoomba\\SOAPLibrary.py", "lineno": 138}, {"name": "Create Soap Session", "args": [{"name": "host", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "host=None"}, {"name": "endpoint", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "endpoint=None"}, {"name": "alias", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "alias=None"}, {"name": "kwargs", "type": null, "types": [], "typedocs": {}, "defaultValue": null, "kind": "VAR_NAMED", "required": false, "repr": "**kwargs"}], "doc": "<p>Create Soap Session. This Keyword utilizes the WSDL to create a soap client.</p>\n<p>host: (string) The host url.</p>\n<p>endpoint: (string) SOAP API endpoint containing the actions to be referenced.</p>\n<p>**kwargs: (optional) Parameters that could be included to add options to client creation. Current supported parameters are:</p>\n<p>set_location: http address</p>", "shortdoc": "Create Soap Session. This Keyword utilizes the WSDL to create a soap client.", "tags": [], "source": "C:\\Git\\robotframework-zoomba\\src\\Zoomba\\SOAPLibrary.py", "lineno": 68}, {"name": "Create Soap Session And Fix Wsdl", "args": [{"name": "host", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "host=None"}, {"name": "endpoint", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "endpoint=None"}, {"name": "alias", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "alias=None"}, {"name": "kwargs", "type": null, "types": [], "typedocs": {}, "defaultValue": null, "kind": "VAR_NAMED", "required": false, "repr": "**kwargs"}], "doc": "<p>Create Soap Session. This Keyword utilizes the WSDL and directly accesses calls from sudsLibrary.</p>\n<p>host: (string) The host url.</p>\n<p>endpoint: (string) SOAP API endpoint containing the actions to be referenced.</p>\n<p>alias: (string} Sets the alias for the SudsLibrary Framework **kwargs: (optional) Parameters that could be included to add options to client creation. Current supported parameters are:</p>\n<p>set_location: http address</p>", "shortdoc": "Create Soap Session. This Keyword utilizes the WSDL and directly accesses calls from sudsLibrary.", "tags": [], "source": "C:\\Git\\robotframework-zoomba\\src\\Zoomba\\SOAPLibrary.py", "lineno": 51}, {"name": "Create Soap Session And Set Location", "args": [{"name": "host", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "host=None"}, {"name": "endpoint", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "endpoint=None"}, {"name": "alias", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "alias=None"}, {"name": "set_location", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "set_location=None"}, {"name": "fix", "type": null, "types": [], "typedocs": {}, "defaultValue": "False", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "fix=False"}], "doc": "<p>Create Soap Session and Set Location. In addition to the client creation, this keyword sets the location as specified.</p>\n<p>host: (string) The host url.</p>\n<p>endpoint: (string) SOAP API endpoint containing the actions to be referenced.</p>\n<p>set_location: (string) If set will overwrite the WSDL location with specified address.</p>\n<p>If set to None will replace location with host and endpoint specified</p>", "shortdoc": "Create Soap Session and Set Location. In addition to the client creation, this keyword sets the location as specified.", "tags": [], "source": "C:\\Git\\robotframework-zoomba\\src\\Zoomba\\SOAPLibrary.py", "lineno": 84}, {"name": "Create Wsdl Objects", "args": [{"name": "wsdl_type", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "wsdl_type=None"}, {"name": "object_dict", "type": null, "types": [], "typedocs": {}, "defaultValue": "None", "kind": "POSITIONAL_OR_NAMED", "required": false, "repr": "object_dict=None"}], "doc": "<p>Create Wsdl Objects. This Keyword utilizes the WSDL to create a WSDL object based on the information provided.</p>\n<p>wsdl_type: (string) Wsdl object to be created.</p>\n<p>object_dict: (dict) Python Dictionary containing values and nested dictionaries with construction similar to wsdl defined objects.</p>\n<p>return: (response object) Returns the SOAP client object.</p>", "shortdoc": "Create Wsdl Objects. This Keyword utilizes the WSDL to create a WSDL object based on the information provided.", "tags": [], "source": "C:\\Git\\robotframework-zoomba\\src\\Zoomba\\SOAPLibrary.py", "lineno": 124}], "dataTypes": {"enums": [], "typedDicts": []}, "typedocs": []}
</script>
<title></title>
</head>
Expand Down
2 changes: 2 additions & 0 deletions src/Zoomba/APILibrary.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import datetime
import json
import warnings

from RequestsLibrary import RequestsLibrary, utils
from dateutil.parser import parse
Expand Down Expand Up @@ -225,63 +226,63 @@
else:
zoomba.fail("The response is not a list:\nActual Response:\n" + str(actual_response_dict))

def key_by_key_validator(self, actual_dictionary, expected_dictionary, ignored_keys=None, unmatched_keys_list=None,
parent_key=None, full_list_validation=False, sort_lists=False, **kwargs):
""" This method is used to find and verify the value of every key in the expectedItem dictionary when compared
against a single dictionary actual_item, unless any keys are included on the ignored_keys array./n

actual_item: (array of dictionaries) The list of dictionary items extracted from a json Response.\n
ExpectedItem: (dictionary) The expected item with the key to be validated.\n
ignored_keys: (strings list) A list of strings of the keys to be ignored on the validation.\n
full_list_validation: (bool) Check that the entire list matches the expected response, defaults to False.\n
sort_lists: (bool) Sort lists before doing key by key validation, defaults to False.\n
**kwargs: (dict) Currently supported kwargs are margin_type and margin_amt\n
margin_type: (string) The type of unit of time to be used to generate a delta for the date comparisons.\n
margin_amt: (string/#) The amount of units specified in margin_type to allot for difference between dates.\n
return: (boolean) If the method completes successfully, it returns True. Appropriate error messages are
returned otherwise.\n
"""
if len(actual_dictionary) != len(expected_dictionary):
zoomba.fail("Collections not the same length:"
"\nActual length: " + str(len(actual_dictionary)) +
"\nExpected length " + str(len(expected_dictionary)))
return
for key, value in expected_dictionary.items():
if ignored_keys and key in ignored_keys:
continue
if key not in actual_dictionary:
zoomba.fail("Key not found in Actual : " + str(actual_dictionary) + " Key: " + str(key))
continue
if isinstance(value, list):
if full_list_validation and len(value) != len(actual_dictionary[key]):
zoomba.fail("Arrays not the same length:" +
"\nExpected: " + str(value) +
"\nActual: " + str(actual_dictionary[key]))
continue
self._key_by_key_list(key, value, actual_dictionary, unmatched_keys_list, ignored_keys, parent_key,
full_list_validation=full_list_validation, sort_lists=sort_lists, **kwargs)
elif isinstance(value, dict):
self._key_by_key_dict(key, value, actual_dictionary, expected_dictionary, unmatched_keys_list,
ignored_keys, full_list_validation=full_list_validation, sort_lists=sort_lists,
**kwargs)
elif (isinstance(expected_dictionary[key], str) and not expected_dictionary[key].isdigit()) or isinstance(expected_dictionary[key], datetime.datetime):
try:
if not isinstance(expected_dictionary[key], datetime.datetime):
parse(expected_dictionary[key])
self.date_string_comparator(value, actual_dictionary[key], key, unmatched_keys_list, **kwargs)
except (ValueError, TypeError):
if value == actual_dictionary[key]:
continue
else:
unmatched_keys_list.append(("------------------\n" + "Key: " + str(key),
"Expected: " + str(value),
"Actual: " + str(actual_dictionary[key])))
elif value == actual_dictionary[key]:
continue
else:
unmatched_keys_list.append(("------------------\n" + "Key: " + str(key), "Expected: " + str(value),
"Actual: " + str(actual_dictionary[key])))
return True

Check notice on line 285 in src/Zoomba/APILibrary.py

View check run for this annotation

codefactor.io / CodeFactor

src/Zoomba/APILibrary.py#L229-L285

Complex Method

def date_string_comparator(self, expected_date, actual_date, key, unmatched_keys_list, **kwargs):
"""This Method is used to validate a single property on a JSON object of the Date Type.
Expand Down Expand Up @@ -454,6 +455,7 @@

def _date_format(date_string, key, unmatched_keys_list, date_type, date_format=None):
formatted_date = None
warnings.filterwarnings("ignore", message=".*Discarding nonzero nanoseconds in conversion.*")
if (date_format is None) and (date_string is not None):
try:
formatted_date = to_datetime(date_string).tz_localize(None).to_pydatetime()
Expand Down
Loading
Loading