def test_client_python3_specific_syntax_completion(jedihttp):
    filepath = utils.fixture_filepath('py3.py')
    request_data = {
        'source': read_file(filepath),
        'line': 19,
        'col': 11,
        'source_path': filepath
    }

    response = requests.post('http://127.0.0.1:{0}/completions'.format(PORT),
                             json=request_data,
                             auth=HmacAuth(SECRET))

    assert_that(response.status_code, equal_to(httplib.OK))

    hmachelper = hmaclib.JediHTTPHmacHelper(SECRET)
    assert_that(hmachelper.is_response_authenticated(response.headers,
                                                     response.content))
def test_client_bad_request_with_parameters(jedihttp):
    filepath = utils.fixture_filepath('goto.py')
    request_data = {
        'source': read_file(filepath),
        'line': 100,
        'col': 1,
        'source_path': filepath
    }

    response = requests.post(
        'http://127.0.0.1:{0}/gotodefinition'.format(PORT),
        json=request_data,
        auth=HmacAuth(SECRET))

    assert_that(response.status_code, equal_to(httplib.INTERNAL_SERVER_ERROR))

    hmachelper = hmaclib.JediHTTPHmacHelper(SECRET)
    assert_that(hmachelper.is_response_authenticated(response.headers,
                                                     response.content))