def test_get_by_id_uses_given_tenant_id_over_current_id( self, mock_session, user_context, mock_get_all_cases_response): mock_session.post.return_value = mock_get_all_cases_response client = DepartingEmployeeClient(mock_session, user_context) client.get_by_id("999", _TENANT_ID_PARAM) post_call_args = json.loads(mock_session.post.call_args[1]["data"]) assert post_call_args["tenantId"] == _TENANT_ID_PARAM
def test_get_by_id_posts_to_expected_url( self, mock_session, user_context, mock_get_all_cases_response_empty): client = DepartingEmployeeClient(mock_session, user_context) mock_session.post.return_value = mock_get_all_cases_response_empty client.get_by_id("999") assert mock_session.post.call_args[0][ 0] == "/svc/api/v1/departingemployee/details"
def test_get_by_id_posts_expected_data(self, mock_session, user_context, mock_get_all_cases_response_empty): client = DepartingEmployeeClient(mock_session, user_context) mock_session.post.return_value = mock_get_all_cases_response_empty client.get_by_id("999") # Have to convert the request data to a dict because # older versions of Python don't have deterministic order. posted_data = json.loads(mock_session.post.call_args[1]["data"]) assert posted_data[ "tenantId"] == TENANT_ID_FROM_RESPONSE and posted_data[ "caseId"] == "999"