This repository has been archived by the owner on Sep 26, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for returned status code and .gitignore
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
- Loading branch information
1 parent
cfaaa4f
commit 651ad18
Showing
6 changed files
with
133 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,5 @@ dist | |
|
||
doc/_build | ||
d2to1-*.egg | ||
|
||
WSME.egg-info/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
""" | ||
This File consists of utils functions used in wsmeext module. | ||
""" | ||
from six.moves import http_client | ||
|
||
|
||
def is_valid_code(code_value): | ||
""" | ||
This function checks if incoming value in http response codes range. | ||
""" | ||
return code_value in http_client.responses |