コード例 #1
0
def test_devfs_ruleset_missing_paths():
    manifest = VALID_MANIFEST.copy()
    manifest["devfs_ruleset"] = {}

    exp_msg = "'paths' is a required property"
    with pytest.raises(RuntimeError, match=exp_msg):
        validate_plugin_manifest(manifest, None, None)
コード例 #2
0
def test_devfs_ruleset_not_dict():
    manifest = VALID_MANIFEST.copy()
    manifest["devfs_ruleset"] = "INVALID_TYPE"

    exp_msg = "'INVALID_TYPE' is not of type 'object'"
    with pytest.raises(RuntimeError, match=exp_msg):
        validate_plugin_manifest(manifest, None, None)
コード例 #3
0
def test_missing_required_fields(missing_field):
    manifest = VALID_MANIFEST.copy()
    del manifest[missing_field]

    exp_msg = f"'{missing_field}' is a required property"
    with pytest.raises(RuntimeError, match=exp_msg):
        validate_plugin_manifest(manifest, None, None)
コード例 #4
0
def test_valid_devfs_ruleset():
    manifest = VALID_MANIFEST.copy()
    manifest["devfs_ruleset"] = {
        "paths": {},
        "includes": []
    }

    validate_plugin_manifest(manifest, None, None)
コード例 #5
0
def test_missing_multiple_required_fields():
    manifest = VALID_MANIFEST.copy()
    del manifest["name"]
    del manifest["packagesite"]

    exp_msg = "'name' is a required property\n"
    exp_msg += "'packagesite' is a required property"
    with pytest.raises(RuntimeError, match=exp_msg):
        validate_plugin_manifest(manifest, None, None)
コード例 #6
0
def test_devfs_ruleset_invalid_includes_type():
    manifest = VALID_MANIFEST.copy()
    manifest["devfs_ruleset"] = {
        "paths": {},
        "includes": "INVALID_TYPE"
    }

    exp_msg = "'INVALID_TYPE' is not of type 'array'"
    with pytest.raises(RuntimeError, match=exp_msg):
        validate_plugin_manifest(manifest, None, None)
コード例 #7
0
def test_validate_plugin_manifest():
    validate_plugin_manifest(VALID_MANIFEST, None, None)