예제 #1
0
def test_to_json():
    validator = InternalValidator()
    validator.add_parameter_message('login', 'login is empty')
    validator.add_parameter_message('password', 'is too short')
    validator.add_parameter_message('password', 'has no special symbol')
    print(validator.to_json())
    assert '{"parameters_messages": [{"messages": ["login is empty"], "parameter": "login"}, {"messages": ["is too short", "has no special symbol"], "parameter": "password"}]}' == validator.to_json(
    )
def test_to_json():
    validator = InternalValidator()
    validator.add_parameter_message('login', 'login is empty')
    validator.add_parameter_message('password', 'is too short')
    validator.add_parameter_message('password', 'has no special symbol')
    actual = validator.to_json()
    print(actual)
    expected = '{"parameters_messages": [{"parameter": "login", "messages": ["login is empty"]}, {"parameter": "password", "messages": ["is too short", "has no special symbol"]}]}'
    print(expected)
    assert expected == actual
예제 #3
0
def activate_custom_domain():

    device_username = request.form['device_username'].lower()
    device_password = request.form['device_password']

    validator = InternalValidator()
    validator.validate(device_username, device_password)

    internal.activate_custom_domain(
        request.form['full_domain'],
        device_username,
        device_password,
    )
    return identification()
예제 #4
0
def activate():

    device_username = request.form['device_username']
    device_password = request.form['device_password']

    validator = InternalValidator()
    validator.validate(device_username, device_password)

    main_domain = get_main_domain(request.form)

    internal.activate(request.form['redirect_email'],
                      request.form['redirect_password'],
                      request.form['user_domain'], device_username,
                      device_password, main_domain)
    return identification()
예제 #5
0
def activate():

    device_username = request.form['device_username'].lower()
    device_password = request.form['device_password']

    validator = InternalValidator()
    validator.validate(device_username, device_password)

    main_domain = 'syncloud.it'
    if 'main_domain' in request.form:
        main_domain = request.form['main_domain']

    internal.activate(request.form['redirect_email'],
                      request.form['redirect_password'],
                      request.form['user_domain'], device_username,
                      device_password, main_domain)
    return identification()
def test_validate_short_credentials():
    validator = InternalValidator()
    with pytest.raises(PassthroughJsonError):
        validator.validate('u', 'p')
def test_validate_good_credentials():
    validator = InternalValidator()
    validator.validate('username', 'password123')