-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BLANK_SCHEME -> NO_SCHEME, option for custom value (#21)
* BLANK_SCHEME -> NO_SCHEME, option for custom value Also use constant in test. * Add docstring for param
- Loading branch information
Showing
2 changed files
with
22 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,45 @@ | ||
from domain_utils import get_scheme | ||
from domain_utils import get_scheme, NO_SCHEME | ||
|
||
|
||
def test_get_scheme_no_scheme(): | ||
def test_no_scheme(): | ||
result = get_scheme("domain.net") | ||
assert result == 'blank' | ||
assert result == NO_SCHEME | ||
|
||
|
||
def test_get_scheme_file(): | ||
def test_file(): | ||
result = get_scheme("file:///home/user/index.html") | ||
assert result == 'file' | ||
|
||
|
||
def test_get_scheme_https(): | ||
def test_https(): | ||
result = get_scheme("https://domain.net") | ||
assert result == 'https' | ||
|
||
|
||
def test_get_scheme_http(): | ||
def test_http(): | ||
result = get_scheme("http://domain.net") | ||
assert result == 'http' | ||
|
||
|
||
def test_get_scheme_about(): | ||
def test_about(): | ||
result = get_scheme("about:config") | ||
assert result == 'about' | ||
|
||
|
||
def test_get_scheme_webpack(): | ||
def test_webpack(): | ||
result = get_scheme("webpack://index.js") | ||
assert result == 'webpack' | ||
|
||
|
||
def test_get_scheme_empty(): | ||
def test_empty(): | ||
result = get_scheme("") | ||
assert result == 'blank' | ||
assert result == NO_SCHEME | ||
|
||
|
||
def test_get_scheme_ws(): | ||
def test_ws(): | ||
result = get_scheme("ws://socket") | ||
assert result == 'ws' | ||
|
||
|
||
def test_pass_custom_empty_value(): | ||
assert get_scheme('10.0.0.1/path/to/index.html', no_scheme=None) is None |