Beispiel #1
0
def test_login_no_db(app_wo_db):
    client = app_wo_db.test_client()
    response = client.post(
        '/api/auth/login',
        data=json.dumps(dict(email='*****@*****.**', password='******')),
        content_type='application/json',
    )
    check_500_error(response)
Beispiel #2
0
def test_user_registration_no_db(app_wo_db: Flask) -> None:
    client = app_wo_db.test_client()
    response = client.post(
        '/api/auth/register',
        data=json.dumps(
            dict(
                username='******',
                email='*****@*****.**',
                password='******',
                password_conf='12345678',
            )),
        content_type='application/json',
    )
    check_500_error(response)
Beispiel #3
0
def test_user_registration_invalid_data(app):
    client = app.test_client()
    response = client.post(
        '/api/auth/register',
        data=json.dumps(
            dict(
                username=1,
                email='*****@*****.**',
                password='******',
                password_conf='12345678',
            )
        ),
        content_type='application/json',
    )
    check_500_error(response)
Beispiel #4
0
def test_update_password_invalid_password_type(app: Flask,
                                               user_1: User) -> None:
    client = app.test_client()
    resp_login = client.post(
        '/api/auth/login',
        data=json.dumps(dict(email='*****@*****.**', password='******')),
        content_type='application/json',
    )
    response = client.post(
        '/api/auth/profile/edit',
        content_type='application/json',
        data=json.dumps(
            dict(
                old_password='******',
                new_password=12_345_678,
                new_password_conf=12_345_678,
            )),
        headers=dict(Authorization='Bearer ' +
                     json.loads(resp_login.data.decode())['auth_token']),
    )
    check_500_error(response)