class SSHGitClientTests(TestCase): def setUp(self): super(SSHGitClientTests, self).setUp() self.server = TestSSHVendor() self.real_vendor = client.get_ssh_vendor client.get_ssh_vendor = lambda: self.server self.client = SSHGitClient('git.samba.org') def tearDown(self): super(SSHGitClientTests, self).tearDown() client.get_ssh_vendor = self.real_vendor def test_get_url(self): path = '/tmp/repo.git' c = SSHGitClient('git.samba.org') url = c.get_url(path) self.assertEqual('ssh://git.samba.org/tmp/repo.git', url) def test_get_url_with_username_and_port(self): path = '/tmp/repo.git' c = SSHGitClient('git.samba.org', port=2222, username='******') url = c.get_url(path) self.assertEqual('ssh://[email protected]:2222/tmp/repo.git', url) def test_default_command(self): self.assertEqual(b'git-upload-pack', self.client._get_cmd_path(b'upload-pack')) def test_alternative_command_path(self): self.client.alternative_paths[b'upload-pack'] = ( b'/usr/lib/git/git-upload-pack') self.assertEqual(b'/usr/lib/git/git-upload-pack', self.client._get_cmd_path(b'upload-pack')) def test_alternative_command_path_spaces(self): self.client.alternative_paths[b'upload-pack'] = ( b'/usr/lib/git/git-upload-pack -ibla') self.assertEqual(b"/usr/lib/git/git-upload-pack -ibla", self.client._get_cmd_path(b'upload-pack')) def test_connect(self): server = self.server client = self.client client.username = b"username" client.port = 1337 client._connect(b"command", b"/path/to/repo") self.assertEqual(b"username", server.username) self.assertEqual(1337, server.port) self.assertEqual(b"git-command '/path/to/repo'", server.command) client._connect(b"relative-command", b"/~/path/to/repo") self.assertEqual(b"git-relative-command '~/path/to/repo'", server.command)
def setUp(self): super(SSHGitClientTests, self).setUp() self.server = TestSSHVendor() self.real_vendor = client.get_ssh_vendor client.get_ssh_vendor = lambda: self.server self.client = SSHGitClient('git.samba.org')
class SSHGitClientTests(TestCase): def setUp(self): super(SSHGitClientTests, self).setUp() self.client = SSHGitClient("git.samba.org") def test_default_command(self): self.assertEquals("git-upload-pack", self.client._get_cmd_path("upload-pack")) def test_alternative_command_path(self): self.client.alternative_paths["upload-pack"] = "/usr/lib/git/git-upload-pack" self.assertEquals("/usr/lib/git/git-upload-pack", self.client._get_cmd_path("upload-pack"))
class SSHGitClientTests(TestCase): def setUp(self): super(SSHGitClientTests, self).setUp() self.client = SSHGitClient('git.samba.org') def test_default_command(self): self.assertEquals('git-upload-pack', self.client._get_cmd_path('upload-pack')) def test_alternative_command_path(self): self.client.alternative_paths['upload-pack'] = '/usr/lib/git/git-upload-pack' self.assertEquals('/usr/lib/git/git-upload-pack', self.client._get_cmd_path('upload-pack'))
class SSHGitClientTests(TestCase): def setUp(self): super(SSHGitClientTests, self).setUp() self.client = SSHGitClient('git.samba.org') def test_default_command(self): self.assertEqual('git-upload-pack', self.client._get_cmd_path('upload-pack')) def test_alternative_command_path(self): self.client.alternative_paths['upload-pack'] = ( '/usr/lib/git/git-upload-pack') self.assertEqual('/usr/lib/git/git-upload-pack', self.client._get_cmd_path('upload-pack'))
class SSHGitClientTests(TestCase): def setUp(self): super(SSHGitClientTests, self).setUp() self.server = TestSSHVendor() self.real_vendor = client.get_ssh_vendor client.get_ssh_vendor = lambda: self.server self.client = SSHGitClient('git.samba.org') def tearDown(self): super(SSHGitClientTests, self).tearDown() client.get_ssh_vendor = self.real_vendor def test_default_command(self): self.assertEqual([b'git-upload-pack'], self.client._get_cmd_path(b'upload-pack')) def test_alternative_command_path(self): self.client.alternative_paths[b'upload-pack'] = ( b'/usr/lib/git/git-upload-pack') self.assertEqual([b'/usr/lib/git/git-upload-pack'], self.client._get_cmd_path(b'upload-pack')) def test_alternative_command_path_spaces(self): self.client.alternative_paths[b'upload-pack'] = ( b'/usr/lib/git/git-upload-pack -ibla') self.assertEqual([b'/usr/lib/git/git-upload-pack', b'-ibla'], self.client._get_cmd_path(b'upload-pack')) def test_connect(self): server = self.server client = self.client client.username = b"username" client.port = 1337 client._connect(b"command", b"/path/to/repo") self.assertEqual(b"username", server.username) self.assertEqual(1337, server.port) self.assertEqual([b"git-command", b"/path/to/repo"], server.command) client._connect(b"relative-command", b"/~/path/to/repo") self.assertEqual([b"git-relative-command", b"~/path/to/repo"], server.command)
class SSHGitClientTests(TestCase): def setUp(self): super(SSHGitClientTests, self).setUp() self.server = TestSSHVendor() self.real_vendor = client.get_ssh_vendor client.get_ssh_vendor = lambda: self.server self.client = SSHGitClient('git.samba.org') def tearDown(self): super(SSHGitClientTests, self).tearDown() client.get_ssh_vendor = self.real_vendor def test_default_command(self): self.assertEqual(['git-upload-pack'], self.client._get_cmd_path(b'upload-pack')) def test_alternative_command_path(self): self.client.alternative_paths[b'upload-pack'] = ( b'/usr/lib/git/git-upload-pack') self.assertEqual(['/usr/lib/git/git-upload-pack'], self.client._get_cmd_path(b'upload-pack')) def test_alternative_command_path_spaces(self): self.client.alternative_paths[b'upload-pack'] = ( b'/usr/lib/git/git-upload-pack -ibla') self.assertEqual(['/usr/lib/git/git-upload-pack', '-ibla'], self.client._get_cmd_path(b'upload-pack')) def test_connect(self): server = self.server client = self.client client.username = b"username" client.port = 1337 client._connect(b"command", "/path/to/repo") self.assertEqual(b"username", server.username) self.assertEqual(1337, server.port) self.assertEqual(["git-command", "/path/to/repo"], server.command) client._connect(b"relative-command", "/~/path/to/repo") self.assertEqual(["git-relative-command", "~/path/to/repo"], server.command)
def test_get_url_with_username_and_port(self): path = '/tmp/repo.git' c = SSHGitClient('git.samba.org', port=2222, username='******') url = c.get_url(path) self.assertEqual('ssh://[email protected]:2222/tmp/repo.git', url)
def test_get_url(self): path = '/tmp/repo.git' c = SSHGitClient('git.samba.org') url = c.get_url(path) self.assertEqual('ssh://git.samba.org/tmp/repo.git', url)
def setUp(self): super(SSHGitClientTests, self).setUp() self.client = SSHGitClient('git.samba.org')