Strip leading :// from URLs to allow quick conversion of a pasted URL to calls (#1197)

* Strip leading `://` from URLs to allow quick conversion of a pasted URL to calls

Closes #1195

* Markdown lint

* Cleanup

* Cleanup

* Drop extraneous space

* Fix example
This commit is contained in:
Jakub Roztocil
2021-11-05 13:59:23 +01:00
committed by GitHub
parent 434512e92f
commit 861b8b36a8
4 changed files with 28 additions and 4 deletions

View File

@ -169,6 +169,16 @@ class TestQuerystring:
assert f'"url": "{url}"' in r
@pytest.mark.parametrize(['program_name', 'url_arg', 'parsed_url'], [
('http', '://pie.dev/get', 'http://pie.dev/get'),
('https', '://pie.dev/get', 'https://pie.dev/get'),
])
def test_url_leading_colon_slash_slash(program_name, url_arg, parsed_url):
env = MockEnvironment(program_name=program_name)
args = parser.parse_args(args=[url_arg], env=env)
assert args.url == parsed_url
class TestLocalhostShorthand:
def test_expand_localhost_shorthand(self):
args = parser.parse_args(args=[':'], env=MockEnvironment())