def test_validate_metadata_blacklisted(ocx):
    initial_appendables = {
        "metadata": {"$uri": "invalid_entry"},
        "tags": [],
        "valid_tags": [],
        "valid_metadata": {"custom": {}},
    }
    with pytest.raises(ValidationError):
        validate_metadata(initial_appendables, ocx)
Beispiel #2
0
def test_validate_metadata_blacklisted(ocx):
    initial_appendables = {
        "metadata": {"$uri": "invalid_entry"},
        "tags": [],
        "valid_tags": [],
        "valid_metadata": {"custom": {}},
    }
    with pytest.raises(ValidationError):
        validate_metadata(initial_appendables, ocx)
Beispiel #3
0
def test_validate_metadata_not_present(ocx):
    initial_appendables = {
        "tags": [],
        "valid_tags": [],
        "valid_metadata": {
            "custom": {}
        }
    }
    final_appendables = dict(initial_appendables)
    validate_metadata(initial_appendables, ocx)
    assert initial_appendables == final_appendables
def test_validate_metadata_custom_valid(ocx):
    initial_appendables = {
        "metadata": {"foo": "bar"},
        "tags": [],
        "valid_tags": [],
        "valid_metadata": {"custom": {}},
    }
    final_appendables = dict(initial_appendables)
    final_appendables["valid_metadata"]["custom"]["foo"] = "bar"
    validate_metadata(initial_appendables, ocx)
    assert initial_appendables == final_appendables
def test_validate_metadata_valid(ocx):
    initial_appendables = {
        "metadata": {"starred": "true"},
        "tags": [],
        "valid_tags": [],
        "valid_metadata": {"custom": {}},
    }
    final_appendables = dict(initial_appendables)
    final_appendables["valid_metadata"]["starred"] = True
    validate_metadata(initial_appendables, ocx)
    assert initial_appendables == final_appendables
Beispiel #6
0
def test_validate_metadata_not_present():
    initial_appendables = {
        'tags': [],
        'valid_tags': [],
        'valid_metadata': {
            'custom': {}
        }
    }
    final_appendables = dict(initial_appendables)
    validate_metadata(initial_appendables, ocx())
    assert initial_appendables == final_appendables
Beispiel #7
0
def test_validate_metadata_custom_valid(ocx):
    initial_appendables = {
        "metadata": {"foo": "bar"},
        "tags": [],
        "valid_tags": [],
        "valid_metadata": {"custom": {}},
    }
    final_appendables = dict(initial_appendables)
    final_appendables["valid_metadata"]["custom"]["foo"] = "bar"
    validate_metadata(initial_appendables, ocx)
    assert initial_appendables == final_appendables
Beispiel #8
0
def test_validate_metadata_valid(ocx):
    initial_appendables = {
        "metadata": {"starred": "true"},
        "tags": [],
        "valid_tags": [],
        "valid_metadata": {"custom": {}},
    }
    final_appendables = dict(initial_appendables)
    final_appendables["valid_metadata"]["starred"] = True
    validate_metadata(initial_appendables, ocx)
    assert initial_appendables == final_appendables
Beispiel #9
0
def test_validate_metadata_blacklisted():
    initial_appendables = {
        'metadata': {
            '$uri': 'invalid_entry'
        },
        'tags': [],
        'valid_tags': [],
        'valid_metadata': {
            'custom': {}
        }
    }
    with pytest.raises(ValidationError):
        validate_metadata(initial_appendables, ocx())
Beispiel #10
0
def test_validate_metadata_valid():
    initial_appendables = {
        'metadata': {
            'starred': 'true'
        },
        'tags': [],
        'valid_tags': [],
        'valid_metadata': {
            'custom': {}
        }
    }
    final_appendables = dict(initial_appendables)
    final_appendables['valid_metadata']['starred'] = True
    validate_metadata(initial_appendables, ocx())
    assert initial_appendables == final_appendables
Beispiel #11
0
def test_validate_metadata_custom_valid():
    initial_appendables = {
        'metadata': {
            'foo': 'bar'
        },
        'tags': [],
        'valid_tags': [],
        'valid_metadata': {
            'custom': {}
        }
    }
    final_appendables = dict(initial_appendables)
    final_appendables['valid_metadata']['custom']['foo'] = 'bar'
    validate_metadata(initial_appendables, ocx())
    assert initial_appendables == final_appendables
def test_validate_metadata_not_present(ocx):
    initial_appendables = {"tags": [], "valid_tags": [], "valid_metadata": {"custom": {}}}
    final_appendables = dict(initial_appendables)
    validate_metadata(initial_appendables, ocx)
    assert initial_appendables == final_appendables