Exemple #1
0
def test_google_query_response_geometry_location(
        mock_response_google_positive):
    """ test google query response if geometry location lat and lng """

    response = Query().query_google_place('openclassrooms').json()
    assert response['candidates'][0]['geometry']['location']['lat'] == 48.8975156 \
           and response['candidates'][0]['geometry']['location']['lng'] == 2.3833993
Exemple #2
0
def test_google_search_response_name_openclassrooms(
        mock_response_google_positive):
    """ test google search response if result openclassrooms """

    response = Query().search_in_google_place('openclassrooms')
    assert response['name'] == 'OpenClassrooms'
Exemple #3
0
def test_google_search_response_key_name(mock_response_google_positive):
    """ test google search response if exist key 'name' """

    response = Query().search_in_google_place('openclassrooms')
    assert 'name' in response
def test_wikimedia_response_key_title(mock_response_wikimedia_positive):
    """ test wikimedia response if key 'title' """

    response = Query().search_in_wikimedia('openclassrooms')
    assert 'title' in response
Exemple #5
0
def test_google_query_response_status_200(mock_response_google_no_result):
    """ test google query response if status code 200 """

    response = Query().query_google_place('aaaaaaaaaaaaaaaaaaaaaaaaa')
    assert response.status_code == 200
Exemple #6
0
def test_google_query_response_key_status_ok(mock_response_google_positive):
    """ test google query response if key status is 'OK' """

    response = Query().query_google_place('openclassrooms')
    assert response.json()['status'] == 'OK'
def test_query_clean_input_space():
    """ test query clean input space """

    input_clean = Query().clean_input_user(' OpenClassRooms ')
    assert input_clean == 'openclassrooms'
Exemple #8
0
def test_google_query_response_not_none(mock_response_google_positive):
    """ test google query response if not none """

    response = Query().query_google_place('openclassrooms')
    assert response is not None
def test_wikimedia_search_description_extract_is_not_none(
        mock_response_wikimedia_extracts):
    """ test wikimedia search description extract is not none for '4338589' """

    response = Query().search_description_in_wikimedia(4338589)
    assert response is not None
def test_wikimedia_search_description_extract_len_size(
        mock_response_wikimedia_extracts):
    """ test wikimedia search description extract len size for '4338589' """

    response = Query().search_description_in_wikimedia(4338589)
    assert len(response) >= 500
def test_wikimedia_response_extract_is_not_none(
        mock_response_wikimedia_extracts):
    """ test wikimedia response extract is not none for '4338589' """

    response = Query().query_wikimedia_desciption('4338589')
    assert response.json() is not None
def test_wikimedia_response_404(mock_response_wikimedia_404):
    """ test wikimedia response 404 code """

    response = Query().search_in_google_place('')
    assert response is None
def test_wikimedia_response_no_result(mock_response_wikimedia_no_result):
    """ test wikimedia response no result """

    response = Query().search_in_wikimedia('aaaaaaaaaaaaaaaaaaaaaaaaa')
    assert response is None
Exemple #14
0
def test_google_search_response_no_result(mock_response_google_no_result):
    """ test google search response no result """

    response = Query().search_in_google_place('aaaaaaaaaaaaaaaaaaaaaaaaa')
    assert response is None
def test_query_clean_input_remove_words_remove_double_space():
    """ test query clean input remove words remove double space in middle """

    input_clean = Query().clean_input_user('adresse  OpenClassRooms')
    assert input_clean == 'adresse openclassrooms'
Exemple #16
0
def test_google_search_response_404(mock_response_google_404):
    """ test google search response 404 code """

    response = Query().search_in_google_place('')
    assert response is None
def test_query_clean_input_remove_words_01():
    """ test query clean input remove words 01 """

    input_clean = Query().clean_input_user(
        'Est-ce que tu connais l\'adresse d\'OpenClassrooms ?')
    assert input_clean == 'l\'adresse d\'openclassrooms ?'
Exemple #18
0
def test_google_query_response_key_status(mock_response_google_positive):
    """ test google query response if key 'status' """

    response = Query().query_google_place('openclassrooms')
    assert 'status' in response.json()
def test_query_clean_input_remove_words_02():
    """ test query clean input remove words 02 """

    input_clean = Query().clean_input_user('L\'adresse du musée du louvre')
    assert input_clean == 'l\'adresse musée louvre'
Exemple #20
0
def test_google_query_response_candidates_gt0(mock_response_google_positive):
    """ test google query response if candidates len > 0 """

    response = Query().query_google_place('openclassrooms')
    assert len(response.json()['candidates']) > 0
def test_query_clean_input_lowercase():
    """ test query clean input lowercase """

    input_clean = Query().clean_input_user('OPENCLASSROOMS')
    assert input_clean == 'openclassrooms'
Exemple #22
0
def test_google_query_response_404(mock_response_google_404):
    """ test google query response 404 code """

    response = Query().query_google_place('')
    assert response.status_code == 404
Exemple #23
0
def test_google_search_response_not_none(mock_response_google_positive):
    """ test google search response if not none """

    response = Query().search_in_google_place('openclassrooms')
    assert response is not None
Exemple #24
0
def test_google_query_response_no_result_candidates_key_candidates(
        mock_response_google_no_result):
    """ test google query response no result candidates key candidates """

    response = Query().query_google_place('aaaaaaaaaaaaaaaaaaaaaaaaa')
    assert 'candidates' in response.json()
def test_wikimedia_response_is_not_none(mock_response_wikimedia_positive):
    """ test wikimedia response is not none """

    response = Query().search_in_wikimedia('openclassrooms')
    assert response is not None