예제 #1
0
def test_hashes_property_valid(value):
    hash_prop = HashesProperty()
    assert hash_prop.clean(value)
예제 #2
0
def test_hashes_property_invalid(value):
    hash_prop = HashesProperty()

    with pytest.raises(ValueError):
        hash_prop.clean(value)
예제 #3
0
def test_hash_property_invalid_key(key):
    p = HashesProperty(["foo"], spec_version="2.0")
    with pytest.raises(DictionaryKeyError):
        p.clean({key: "foo"}, True)
예제 #4
0
def test_hash_property_valid_key(key):
    p = HashesProperty(["foo"], spec_version="2.0")
    result = p.clean({key: "bar"}, True)
    assert result == ({key: "bar"}, True)
def test_hashes_property_invalid(value):
    hash_prop = HashesProperty(["sha256", "md5"])

    with pytest.raises(ValueError):
        hash_prop.clean(value, False)
def test_hashes_property_valid(value):
    hash_prop = HashesProperty(["sha256", "md5", "ripemd160"])
    _, has_custom = hash_prop.clean(value, False)
    assert not has_custom