コード例 #1
0
ファイル: test_plugins.py プロジェクト: psav/insights-core
def test_validate_response_invalid_error_key_type():
    for bad in [{}, None, 1, lambda x: x, set()]:
        with pytest.raises(plugins.ValidationException):
            plugins.validate_response({
                "type": "rule",
                "error_key": bad
            })
コード例 #2
0
ファイル: test_plugins.py プロジェクト: psav/insights-core
def test_validate_fingerprint_invalid_fingerprint_key_type():
    for bad in [{}, None, 1, lambda x: x, set()]:
        with pytest.raises(plugins.ValidationException):
            plugins.validate_response({
                "type": "fingerprint",
                "fingerprint_key": bad
            })
コード例 #3
0
ファイル: test_plugins.py プロジェクト: psav/insights-core
def test_validate_response_missing_fingerprint_key():
    with pytest.raises(plugins.ValidationException):
        plugins.validate_response({"type": "fingerprint", "foo": "bar"})
コード例 #4
0
ファイル: test_plugins.py プロジェクト: psav/insights-core
def test_validate_fingerprint_good():
    assert plugins.validate_response({
        "type": "fingerprint",
        "fingerprint_key": "FINGERPRINT",
        "foo": "bar"}) is None
コード例 #5
0
ファイル: test_plugins.py プロジェクト: psav/insights-core
def test_validate_response_missing_error_key():
    with pytest.raises(plugins.ValidationException):
        plugins.validate_response({"type": "rule", "foo": "bar"})
コード例 #6
0
ファイル: test_plugins.py プロジェクト: psav/insights-core
def test_validate_response_invalid_type_key():
    with pytest.raises(plugins.ValidationException):
        plugins.validate_response({"type": "dance off"})
コード例 #7
0
ファイル: test_plugins.py プロジェクト: psav/insights-core
def test_validate_response_missing_type():
    with pytest.raises(plugins.ValidationException):
        plugins.validate_response({"error_key": "an_error"})
コード例 #8
0
ファイル: test_plugins.py プロジェクト: psav/insights-core
def test_validate_response_invalid_types():
    for bad in [[], None, set(), "", 1, lambda x: x]:
        with pytest.raises(plugins.ValidationException):
            plugins.validate_response(bad)
コード例 #9
0
ファイル: test_plugins.py プロジェクト: psav/insights-core
def test_validate_response_good():
    assert plugins.validate_response({
        "type": "rule",
        "error_key": "a_test",
        "foo": "bar"}) is None