This repository has been archived by the owner on Mar 22, 2022. 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.
Merge branch 'master' into web-api-changes
- Loading branch information
Showing
9 changed files
with
69 additions
and
3 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
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,4 @@ | ||
coloredlogs==10.0 | ||
Jinja2==2.10.1 | ||
spur==0.3.20 | ||
voluptuous==0.11.1 |
Empty file.
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
Empty file.
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,14 @@ | ||
import pytest | ||
from shell_manager import config | ||
|
||
|
||
@pytest.mark.parametrize("port_range, expected_string", [ | ||
([dict(start=0, end=65535)], "[0-65535]"), | ||
([dict(start=1000, end=1000)], "[1000]"), | ||
([dict(start=1000, end=1000), dict(start=1000, end=10000)], | ||
"[1000, 1000-10000]"), | ||
]) | ||
def test_port_range_to_str(port_range, expected_string): | ||
"""Test strings are correctly created from port range lists.""" | ||
returned_string = config.banned_ports_to_str(port_range) | ||
assert expected_string == returned_string |
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,26 @@ | ||
import pytest | ||
from shell_manager import util | ||
|
||
|
||
@pytest.mark.parametrize("problem_name, expected_name", [ | ||
("Test Problem", "test-problem"), | ||
("01234", "p01234"), | ||
("1 2 spaces", "p1-2--spaces"), | ||
]) | ||
def test_problem_name_sanitization(problem_name, expected_name): | ||
"""Test valid problem names are correctly sanitized.""" | ||
sanitized_name = util.sanitize_name(problem_name) | ||
assert expected_name == sanitized_name | ||
|
||
|
||
@pytest.mark.parametrize("problem_name", [ | ||
"", | ||
None, | ||
]) | ||
def test_invalid_prob_name_sanitization(problem_name): | ||
"""Test invalid problem names raise an exception during sanitization.""" | ||
with pytest.raises(Exception) as excep_info: | ||
util.sanitize_name(problem_name) | ||
assert "Can not sanitize an empty field" in str(excep_info.value) | ||
|
||
|
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