Anton Shestakov <av6@dwimlabs.net>, Sun, 19 Jun 2016 16:22:28 +0800
models: add Project.get_title() method, use it, test it
tests/test_incoming.py
Permissions: -rw-r--r--
from incoming import parse_project_url def test_parse_project_url(): result = parse_project_url('https://example.com/alice/hello-world') assert result == ('example.com', 'alice', 'hello-world') result = parse_project_url('~alice/hello-world') assert result == ('self', '~alice', 'hello-world') result = parse_project_url('https://code.example.com/hello-world') assert result == ('code.example.com', None, 'hello-world') result = parse_project_url('https://example.com/scm/projects/hello-world') assert result == ('example.com', 'scm', 'projects/hello-world') result = parse_project_url('https://example.com///hello-world//') assert result == ('example.com', None, 'hello-world')