def test_user_cannot_register_with_valid_data_twice(faker):
    user = {
        "username": faker.name(),
        "password": "******",
        "email": faker.email()
    }
    userApiService = UserApiService()

    response = userApiService.create_user(user)
    response.should_have(status_code(200))
    response = userApiService.create_user(user)
    response.should_have(status_code(500))
def test_cant_registrate_the_same_user(faker):
    user = {
        "username": faker.name(),
        "password": "******",
        "email": "*****@*****.**"
    }

    response = UserApiService().create_user(user)

    response.should_have(status_code(200))

    response = UserApiService().create_user(user)

    response.should_have(status_code(500))
Esempio n. 3
0
def test_user_can_change_password():
    user = {
        "email": "*****@*****.**",
        "password": "******",
        "confirmPassword": "******"
    }
    response = UserApiService().change_password(user)
    response.should_have(status_code(200))
def test_can_registrate_user_with_valid_creds(faker):
    user = {
        "username": faker.name(),
        "password": "******",
        "email": "*****@*****.**"
    }
    response = UserApiService().create_user(user)

    response.should_have(status_code(200))
    response.should_have(body("$.id", has_length(greater_than(0))))
Esempio n. 5
0
def test_not_existed_user_cannot_change_password(faker):
    user = {
        "email": faker.email(),
        "password": "******",
        "confirmPassword": "******"
    }
    response = UserApiService().change_password(user)
    response.should_have(status_code(400))
    response.should_have(
        body(
            'Message',
            assert_that({
                'Message': 'Користувача з таким логіном не знайдено'
            }).contains_value('Користувача з таким логіном не знайдено')))
def test_user_can_signup_with_valid_credentials(faker):
    user = {
        "firstName": faker.name(),
        "lastName": faker.name(),
        "email": faker.email(),
        "password": "******",
        "confirmPassword": "******",
        "emailConfirmed": True
    }

    response = UserApiService().create_user(user)
    response.should_have(status_code(201))
    response.should_have(
        body("succeeded",
             assert_that({
                 'succeeded': 'true'
             }).contains_value('true')))
def test_user_cannot_signup_with_same_credentials(faker):
    user = {
        "firstName": faker.name(),
        "lastName": faker.name(),
        "email": "*****@*****.**",
        "password": "******",
        "confirmPassword": "******",
        "emailConfirmed": True
    }

    response = UserApiService().create_user(user)
    response.should_have(status_code(500))
    response.should_have(
        body(
            "Message",
            assert_that({
                'Message': 'AdSaver. User allready exists'
            }).contains_value('ERROR_AdSaver. User allready exists')))