Make path validation raise ValidationError instead of ValueError
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
from earthsnake.exc import ValidationError
|
||||
from earthsnake.identity import Identity
|
||||
from earthsnake.path import Path
|
||||
|
||||
@@ -22,7 +23,7 @@ from earthsnake.path import Path
|
||||
def test_invalid(path: str, error_msg: str) -> None:
|
||||
"""Test if validation fails for invalid paths"""
|
||||
|
||||
with pytest.raises(ValueError) as ctx:
|
||||
with pytest.raises(ValidationError) as ctx:
|
||||
Path.validate(path)
|
||||
|
||||
assert error_msg in str(ctx.value)
|
||||
@@ -31,7 +32,7 @@ def test_invalid(path: str, error_msg: str) -> None:
|
||||
def test_invalid_non_ephemeral() -> None:
|
||||
"""Test validating ephemeral paths when ephemeral is not allowed"""
|
||||
|
||||
with pytest.raises(ValueError) as ctx:
|
||||
with pytest.raises(ValidationError) as ctx:
|
||||
Path.validate('/ephemeral!')
|
||||
|
||||
assert 'Only ephemeral paths may contain !' in str(ctx.value)
|
||||
|
Reference in New Issue
Block a user