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

Fix the inference body to send an actual test session id #23

Merged
merged 1 commit into from
Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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