~ubuntu-branches/ubuntu/precise/dulwich/precise-security

« back to all changes in this revision

Viewing changes to dulwich/tests/test_client.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2011-08-07 15:03:44 UTC
  • mto: This revision was merged to the branch mainline in revision 25.
  • Revision ID: james.westby@ubuntu.com-20110807150344-94xw3o3hnh47y1m8
Tags: upstream-0.8.0
ImportĀ upstreamĀ versionĀ 0.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 
36
36
 
37
37
class DummyClient(GitClient):
 
38
 
38
39
    def __init__(self, can_read, read, write):
39
40
        self.can_read = can_read
40
41
        self.read = read
64
65
 
65
66
    def test_fetch_pack_none(self):
66
67
        self.rin.write(
67
 
            '008855dcc6bf963f922e1ed5c4bbaaefcfacef57b1d7 HEAD.multi_ack thin-pack side-band side-band-64k ofs-delta shallow no-progress include-tag\n'
 
68
            '008855dcc6bf963f922e1ed5c4bbaaefcfacef57b1d7 HEAD.multi_ack '
 
69
            'thin-pack side-band side-band-64k ofs-delta shallow no-progress '
 
70
            'include-tag\n'
68
71
            '0000')
69
72
        self.rin.seek(0)
70
73
        self.client.fetch_pack('bla', lambda heads: [], None, None, None)
91
94
        self.assertEquals(None, client.username)
92
95
        self.assertEqual('/bar/baz', path)
93
96
 
94
 
        client, path = get_transport_and_path('git+ssh://foo.com:1234/bar/baz')
 
97
        client, path = get_transport_and_path(
 
98
            'git+ssh://foo.com:1234/bar/baz')
95
99
        self.assertTrue(isinstance(client, SSHGitClient))
96
100
        self.assertEquals('foo.com', client.host)
97
101
        self.assertEquals(1234, client.port)
127
131
    def test_get_transport_and_path_error(self):
128
132
        # Need to use a known urlparse.uses_netloc URL scheme to get the
129
133
        # expected parsing of the URL on Python versions less than 2.6.5
130
 
        self.assertRaises(ValueError, get_transport_and_path, 'prospero://bar/baz')
 
134
        self.assertRaises(ValueError, get_transport_and_path,
 
135
        'prospero://bar/baz')
131
136
 
132
137
 
133
138
class SSHGitClientTests(TestCase):
137
142
        self.client = SSHGitClient('git.samba.org')
138
143
 
139
144
    def test_default_command(self):
140
 
        self.assertEquals('git-upload-pack', self.client._get_cmd_path('upload-pack'))
 
145
        self.assertEquals('git-upload-pack',
 
146
                self.client._get_cmd_path('upload-pack'))
141
147
 
142
148
    def test_alternative_command_path(self):
143
 
        self.client.alternative_paths['upload-pack'] = '/usr/lib/git/git-upload-pack'
144
 
        self.assertEquals('/usr/lib/git/git-upload-pack', self.client._get_cmd_path('upload-pack'))
 
149
        self.client.alternative_paths['upload-pack'] = (
 
150
            '/usr/lib/git/git-upload-pack')
 
151
        self.assertEquals('/usr/lib/git/git-upload-pack',
 
152
            self.client._get_cmd_path('upload-pack'))
145
153