
For this purposes I added addiitional processing of original exceptions at wsme/wsmeext/pecan.py. For exception's validation special validator was added to wsme/wsmeext/utils.py. Also functionality was reworked to be compatible with python3.3 Fixes bug#1214073 Change-Id: Ib1cd0b274bda11f62298848ebcd55b3f6641757c
16 lines
551 B
Python
16 lines
551 B
Python
from wsmeext.utils import is_valid_code
|
|
|
|
|
|
class TestUtils():
|
|
|
|
def test_validator_with_valid_code(self):
|
|
valid_code = 404
|
|
assert is_valid_code(valid_code), "Valid status code not detected"
|
|
|
|
def test_validator_with_invalid_int_code(self):
|
|
invalid_int_code = 648
|
|
assert not is_valid_code(invalid_int_code), "Invalid status code not detected"
|
|
|
|
def test_validator_with_invalid_str_code(self):
|
|
invalid_str_code = '404'
|
|
assert not is_valid_code(invalid_str_code), "Invalid status code not detected" |