Esempio n. 1
0
def test_get_search_recommandation_in_title_special_char(app):
    r = req.get(
        API_URL +
        '/recommendations/search?title=vélo ça là être @#+%*$ $£è çàé &')
    search_json = r.json()
    assert r.status_code == 200
    assert len(search_json['recommendations']) == 3
def test_search_without_text_in_the_form(app):
    user = create_user()
    user.id = 1
    BaseObject.check_and_save(user)
    create_reco("recommendations_data_test")
    r = req.get(API_URL + '/recommendations/search?title=""')
    search_json = r.json()
    assert r.status_code == 400
    assert search_json['error'] == 'No recommendation found'
Esempio n. 3
0
def get(url, authenticated=False):
    if authenticated:
        r = req_with_auth.get(API_URL + url)
    else:
        r = req.get(API_URL + url)
    if r.headers.get('content-type') == 'application/json':
        pprint(r.json())
    else:
        print(r.text)
def test_search_sql_injection_all(app):
    r = req.get(API_URL + '/recommendations/search?title=*')
    search_json = r.json()
    assert r.status_code == 200
    assert len(search_json['recommendations']) == 1
def test_search_without_parameters(app):
    r = req.get(API_URL + '/recommendations/search?')
    search_json = r.json()
    assert r.status_code == 400
    assert search_json['error'] == 'Wrong field'
def test_search_should_not_work_with_wrong_parameters(app):
    r = req.get(API_URL + '/recommendations/search?wrong_field=blablablablabla')
    search_json = r.json()
    assert r.status_code == 400
    assert search_json['error'] == 'Wrong field'
def test_get_search_recommandation_in_title(app):
    r = req.get(API_URL + '/recommendations/search?title=prends vélo')
    search_json = r.json()
    print("test d'ecriture")
    assert r.status_code == 200
    assert len(search_json['recommendations']) == 3
def test_10_get_offerers_should_work_only_when_logged_in():
    r = req.get(API_URL + '/offerers')
    assert r.status_code == 401
Esempio n. 9
0
def test_13_get_profile_should_work_only_when_logged_in():
    r = req.get(API_URL + '/users/me')
    assert r.status_code == 401