Skip to content

Commit

Permalink
Fix the inference body to send an actual test session id (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
shuheiktgw committed Dec 8, 2020
1 parent 707299a commit eb5fb89
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 1 addition & 3 deletions nose_launchable/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ def _get_base_url(cls):


class LaunchableClient:
# TODO: Stop using a fictitious id once the server starts dynamic reordering
FICTITIOUS_ID = "1"
CLIENT_NAME = "nose-launchable"

def __init__(self, base_url, org_name, workspace_name, token, http):
Expand Down Expand Up @@ -111,7 +109,7 @@ def _headers(self):
def _infer_request_body(self, test):
return {
"test": test,
"session": {"id": self.FICTITIOUS_ID, "subject": self.FICTITIOUS_ID, "flavors": {}},
"session": {"id": self.test_session_id, "subject": self.build_number, "flavors": {}},
}

def _upload_request_body(self, events):
Expand Down
4 changes: 3 additions & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def test_infer(self):
mock_requests.post.return_value = mock_response

client = LaunchableClient("base_url", "org_name", "wp_name", "token", mock_requests)
client.build_number = "test"
client.test_session_id = 1

test = {
"type": "tree",
Expand All @@ -87,7 +89,7 @@ def test_infer(self):

expected_body = {
'test': {'type': 'tree', 'root': {'type': 'testCaseNode', 'testName': 'class0.test0'}},
"session": {'id': '1', 'subject': '1', 'flavors': {}},
"session": {'id': 1, 'subject': 'test', 'flavors': {}},
}

mock_requests.post.assert_called_once_with(expected_url, headers=expected_headers, json=expected_body)
Expand Down

0 comments on commit eb5fb89

Please sign in to comment.