Skip to content

Commit

Permalink
Merge pull request #38 from everactive/master
Browse files Browse the repository at this point in the history
Minor fixes to support the latest changes in Xray Cloud
  • Loading branch information
fundakol committed Mar 9, 2022
2 parents feade9b + e56691e commit 3d155b1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/pytest_xray/xray_publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __call__(self, r: requests.PreparedRequest) -> requests.PreparedRequest:
_logger.exception(err_message)
raise XrayError(err_message) from exc
else:
auth_token = response.text
auth_token = response.text.replace('"', '')
r.headers['Authorization'] = f'Bearer {auth_token}'
return r

Expand Down Expand Up @@ -114,5 +114,6 @@ def publish(self, data: dict) -> str:
:return: test execution issue id
"""
response_data = self._send_data(self.endpoint_url, self.auth, data)
key = response_data['testExecIssue']['key']
# The Xray cloud response does not include the 'testExecIssue' attribute
key = response_data['testExecIssue']['key'] if 'testExecIssue' in response_data else response_data['key']
return key
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def http_server(environment_variables):
# cloud
server.add_json_response(
'/api/v2/import/execution',
{'testExecIssue': {'key': '1000'}},
{'key': '1000'},
methods=('POST',)
)
server.add_callback_response(
Expand Down

0 comments on commit 3d155b1

Please sign in to comment.