Exemplo n.º 1
0
def test_existing_path(tmpdir):
    """ Test Existing Path """
    remote = Remote()
    url = tmpdir.mkdir("srv").strpath
    remote.url = url
    remote.parse_url()
    assert remote.prefix == url + os.path.sep
Exemplo n.º 2
0
def test_url_ssh_with_username_with_subfolder():
    remote = Remote()
    remote.url = "ssh://git@foo/bar/baz"
    remote.parse_url()
    assert remote.prefix == "ssh://git@foo/bar/baz/"
    assert remote.server == "foo"
    assert remote.username == "git"
Exemplo n.º 3
0
def test_url_ssh_with_username_with_subfolder():
    remote = Remote()
    remote.url = "ssh://git@foo/bar/baz"
    remote.parse_url()
    assert remote.prefix == "ssh://git@foo/bar/baz/"
    assert remote.server == "foo"
    assert remote.username == "git"
Exemplo n.º 4
0
def test_url_git():
    remote = Remote()
    remote.url = "git://example.com"
    remote.parse_url()
    assert remote.prefix == "git://example.com/"
    assert remote.protocol == "git"
    assert remote.server == "example.com"
Exemplo n.º 5
0
def test_url_git():
    remote = Remote()
    remote.url = "git://example.com"
    remote.parse_url()
    assert remote.prefix == "git://example.com/"
    assert remote.protocol == "git"
    assert remote.server == "example.com"
Exemplo n.º 6
0
def test_url_filepath():
    """ Test Url FilePath """
    remote = Remote()
    remote.url = "file:///path/to/dir"
    remote.parse_url()
    assert remote.prefix == "file:///path/to/dir/"
    assert remote.protocol == "file"
Exemplo n.º 7
0
def test_url_ssh_with_username_no_subfolder():
    """ Test Url Ssh With Username No SubFolder """
    remote = Remote()
    remote.url = "ssh://git@foo/"
    remote.parse_url()
    assert remote.prefix == "ssh://git@foo/"
    assert remote.username == "git"
Exemplo n.º 8
0
def test_ssh_url():
    remote = Remote()
    remote.url = "*****@*****.**"
    remote.parse_url()
    assert remote.prefix == "[email protected]:"
    assert remote.server == "example.com"
    assert remote.protocol == "ssh"
    assert not remote.port
Exemplo n.º 9
0
def test_url_https_trailing_slash():
    remote = Remote()
    remote.url = "https://review.corp/"
    remote.parse_url()
    assert remote.prefix == "https://review.corp/"
    assert remote.server == "review.corp"
    assert remote.protocol == "https"
    assert not remote.port
Exemplo n.º 10
0
def test_url_http():
    remote = Remote()
    remote.url = "http://review.corp:8080"
    remote.parse_url()
    assert remote.prefix == "http://review.corp:8080/"
    assert remote.server == "review.corp"
    assert remote.port == 8080
    assert remote.protocol == "http"
Exemplo n.º 11
0
def test_url_win_filepath():
    if not os.name == "nt":
        return
    remote = Remote()
    remote.url = r"file:///c:\path\to\foo"
    remote.parse_url()
    assert remote.prefix == r"file:///c:\path\to\foo" + "\\"
    assert remote.protocol == "file"
Exemplo n.º 12
0
def test_ssh_url():
    remote = Remote()
    remote.url = "*****@*****.**"
    remote.parse_url()
    assert remote.prefix == "[email protected]:"
    assert remote.server == "example.com"
    assert remote.protocol == "ssh"
    assert not remote.port
Exemplo n.º 13
0
def test_url_http():
    remote = Remote()
    remote.url = "http://review.corp:8080"
    remote.parse_url()
    assert remote.prefix == "http://review.corp:8080/"
    assert remote.server == "review.corp"
    assert remote.port == 8080
    assert remote.protocol == "http"
Exemplo n.º 14
0
def test_url_https_trailing_slash():
    remote = Remote()
    remote.url = "https://review.corp/"
    remote.parse_url()
    assert remote.prefix == "https://review.corp/"
    assert remote.server == "review.corp"
    assert remote.protocol == "https"
    assert not remote.port
Exemplo n.º 15
0
def test_url_win_filepath():
    if not os.name == 'nt':
        return
    remote = Remote()
    remote.url = r"file:///c:\path\to\foo"
    remote.parse_url()
    assert remote.prefix == r"file:///c:\path\to\foo" + "\\"
    assert remote.protocol == "file"
Exemplo n.º 16
0
def test_url_win_filepath():
    """ Test Url Win FilePath """
    if not os.name == 'nt':
        return
    remote = Remote()
    remote.url = r"file:///c:\path\to\foo"
    remote.parse_url()
    assert remote.prefix == r"file:///c:\path\to\foo" + "\\"
    assert remote.protocol == "file"
Exemplo n.º 17
0
def test_url_ssh_no_username():
    with mock.patch("qisrc.review.get_gerrit_username") as get_username:
        get_username.return_value = "john"
        remote = Remote()
        remote.url = "ssh://review.corp:29418"
        remote.parse_url()
        assert remote.prefix == "ssh://[email protected]:29418/"
        assert remote.server == "review.corp"
        assert remote.port == 29418
        assert remote.protocol == "ssh"
        assert remote.username == "john"
Exemplo n.º 18
0
def test_gerrit_url_ssh_subfolder():
    with mock.patch("qisrc.review.get_gerrit_username") as get_username:
        get_username.return_value = "john"
        remote = Remote()
        remote.url = "ssh://review.corp:29418/a/subfolder"
        remote.parse_url()
        assert remote.prefix == "ssh://[email protected]:29418/a/subfolder/"
        assert remote.port == 29418
        remote.url = "ssh://review.corp:29418/a/subfolder/"
        remote.parse_url()
        assert remote.prefix == "ssh://[email protected]:29418/a/subfolder/"
Exemplo n.º 19
0
def test_url_ssh_no_username():
    with mock.patch("qisrc.review.get_gerrit_username") as get_username:
        get_username.return_value = "john"
        remote = Remote()
        remote.url = "ssh://review.corp:29418"
        remote.parse_url()
        assert remote.prefix == "ssh://[email protected]:29418/"
        assert remote.server == "review.corp"
        assert remote.port == 29418
        assert remote.protocol == "ssh"
        assert remote.username == "john"
Exemplo n.º 20
0
def test_gerrit_url_ssh_subfolder():
    with mock.patch("qisrc.review.get_gerrit_username") as get_username:
        get_username.return_value = "john"
        remote = Remote()
        remote.url = "ssh://review.corp:29418/a/subfolder"
        remote.parse_url()
        assert remote.prefix == "ssh://[email protected]:29418/a/subfolder/"
        assert remote.port == 29418
        remote.url = "ssh://review.corp:29418/a/subfolder/"
        remote.parse_url()
        assert remote.prefix == "ssh://[email protected]:29418/a/subfolder/"
Exemplo n.º 21
0
def test_url_ssh_with_username_no_subfolder():
    remote = Remote()
    remote.url = "ssh://git@foo/"
    remote.parse_url()
    assert remote.prefix == "ssh://git@foo/"
    assert remote.username == "git"
Exemplo n.º 22
0
def test_url_ssh_with_username_no_subfolder():
    remote = Remote()
    remote.url = "ssh://git@foo/"
    remote.parse_url()
    assert remote.prefix == "ssh://git@foo/"
    assert remote.username == "git"