示例#1
0
def test_config_check_str_bad():
    value = {"11111": "x"}
    with pytest.raises(ConfigInvalidValue):
        config_check_str(value=value, schema=SCHEMA_STR, source="badwolf")

    with pytest.raises(ConfigInvalidValue):
        config_check(value=value, schema=SCHEMA_STR, source="badwolf")
示例#2
0
def test_config_check_str_enum_bad():
    value = "xxxx"
    with pytest.raises(ConfigInvalidValue):
        config_check_str(value=value, schema=SCHEMA_STR_ENUM, source="badwolf")

    with pytest.raises(ConfigInvalidValue):
        config_check(value=value, schema=SCHEMA_STR_ENUM, source="badwolf")
示例#3
0
def test_config_check_str():
    value = "test"
    result = config_check_str(value=value, schema=SCHEMA_STR, source="badwolf")
    assert result == value

    result = config_check(value=value, schema=SCHEMA_STR, source="badwolf")
    assert result == value
示例#4
0
def test_config_check_str_password_unchanged(value):
    result = config_check_str(value=value,
                              schema=SCHEMA_STR_PASSWORD,
                              source="badwolf")
    assert result == SETTING_UNCHANGED

    result = config_check(value=value,
                          schema=SCHEMA_STR_PASSWORD,
                          source="badwolf")
    assert result == SETTING_UNCHANGED
示例#5
0
def test_config_check_str_password():
    value = "badwolf"
    result = config_check_str(value=value,
                              schema=SCHEMA_STR_PASSWORD,
                              source="badwolf")
    assert result == value

    result = config_check(value=value,
                          schema=SCHEMA_STR_PASSWORD,
                          source="badwolf")
    assert result == value
def test_config_check_str_enum():
    """Pass."""
    value = "badwolf"
    result = config_check_str(value=value,
                              schema=SCHEMA_STR_ENUM,
                              source="badwolf")
    assert result == value

    result = config_check(value=value,
                          schema=SCHEMA_STR_ENUM,
                          source="badwolf")
    assert result == value