Skip to content

Commit

Permalink
deprecate create connection as it was just a post call anyway (#199)
Browse files Browse the repository at this point in the history
* deprecate create connection as it was just a post call anyway

* change deprecated flag
  • Loading branch information
Wolfe1 authored May 12, 2021
1 parent 08c21cb commit 99bb76f
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 31 deletions.
4 changes: 2 additions & 2 deletions docs/APILibraryDocumentation.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/DesktopLibraryDocumentation.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/MobileLibraryDocumentation.html

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

19 changes: 2 additions & 17 deletions src/Zoomba/APILibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,23 +117,8 @@ def call_put_request(self, headers=None, endpoint=None, fullstring=None, data=No
return _convert_resp_to_dict(resp)

def create_connection(self, endpoint, method, data, headers=None, cookies=None, timeout=None):
""" Opens a connection to an Application Endpoint. This Keyword is used commonly as part of a Login or Initial
Authentication request. Given it's similarities to a pure post request, this could be deprecated in the near
future.\n
headers: (dictionary) The headers to be sent as part of the request.\n
endpoint: (string) The string that identifies the url endpoint of the App that receives API requests.\n
fullstring: (string) A string that contains the rest of the url that identifies a specific API/Webservice
along with any query parameters.\n
timeout: (float) Time in seconds for the connection to respond\n
data: (json) The JSON object to be sent on the body of the request to be used by the specific Web service.\n
return: (response object) Returns the request response object, which includes headers, content, etc.\n
"""
if self.suppress_warnings:
urllib3.disable_warnings(InsecureRequestWarning)
session = requests_lib.create_session("postapi", endpoint, headers, cookies=cookies, timeout=timeout)
data = utils.format_data_according_to_header(session, data, headers)
resp = requests_lib.post_on_session("postapi", method, data, timeout=timeout, expected_status='any')
return _convert_resp_to_dict(resp)
"""*DEPRECATED!!* Use 'Call Post Request' instead."""
return self.call_post_request(headers=headers, endpoint=endpoint, fullstring=method, data=data, cookies=cookies, timeout=timeout)

def validate_response_contains_expected_response(self, json_actual_response, expected_response_dict,
ignored_keys=None, full_list_validation=False, identity_key="",
Expand Down
8 changes: 4 additions & 4 deletions test/API/test_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def test_basic_create_connection(self, post_on_session, create_session):
assert r.text == "success"
assert r.status_code == 200
create_session.assert_called_with('postapi', 'Endpoint', {'a': 'Text'}, cookies=None, timeout=None)
post_on_session.assert_called_with('postapi', 'fullstring', None, timeout=None, expected_status='any')
post_on_session.assert_called_with('postapi', 'fullstring', None, files=None, timeout=None, expected_status='any')

@patch('RequestsLibrary.SessionKeywords.SessionKeywords.create_session')
@patch('RequestsLibrary.RequestsOnSessionKeywords.post_on_session')
Expand All @@ -285,7 +285,7 @@ def test_files_create_connection(self, post_on_session, create_session):
assert r.text == "success"
assert r.status_code == 200
create_session.assert_called_with('postapi', 'Endpoint', {'a': 'Text'}, cookies=None, timeout=None)
post_on_session.assert_called_with('postapi', 'fullstring', b'item', timeout=None, expected_status='any')
post_on_session.assert_called_with('postapi', 'fullstring', b'item', files=None, timeout=None, expected_status='any')

@patch('RequestsLibrary.SessionKeywords.SessionKeywords.create_session')
@patch('RequestsLibrary.RequestsOnSessionKeywords.post_on_session')
Expand All @@ -296,7 +296,7 @@ def test_create_connection_insecure_request(self, disable_warnings, post_on_sess
library.create_connection("Endpoint", "fullstring", None, headers={"a": "Text"})
disable_warnings.assert_called()
create_session.assert_called_with('postapi', 'Endpoint', {'a': 'Text'}, cookies=None, timeout=None)
post_on_session.assert_called_with('postapi', 'fullstring', None, timeout=None, expected_status='any')
post_on_session.assert_called_with('postapi', 'fullstring', None, files=None, timeout=None, expected_status='any')

@patch('RequestsLibrary.SessionKeywords.SessionKeywords.create_session')
@patch('RequestsLibrary.RequestsOnSessionKeywords.post_on_session')
Expand All @@ -310,4 +310,4 @@ def test_create_connection_with_cookies(self, post_on_session, create_session):
assert r.status_code == 200
assert r.cookies["chocolate_chip"] == "tasty"
create_session.assert_called_with('postapi', 'Endpoint', {'a': 'Text'}, cookies='chocolate_chip', timeout=None)
post_on_session.assert_called_with('postapi', 'fullstring', None, timeout=None, expected_status='any')
post_on_session.assert_called_with('postapi', 'fullstring', None, files=None, timeout=None, expected_status='any')

0 comments on commit 99bb76f

Please sign in to comment.