def test_check_integrity_error():
    descriptor = deepcopy(DESCRIPTOR)
    descriptor['bytes'] += 1
    descriptor['hash'] += 'a'
    resource = Resource(descriptor)
    with pytest.raises(exceptions.IntegrityError) as excinfo:
        resource.check_integrity()
    assert str(DESCRIPTOR['bytes']) in str(excinfo.value)
    assert DESCRIPTOR['hash'].replace('sha256:', '') in str(excinfo.value)
def test_check_integrity():
    descriptor = deepcopy(DESCRIPTOR)
    resource = Resource(descriptor)
    assert resource.check_integrity()