/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/git/tests/test_remote.py

  • Committer: Jelmer Vernooij
  • Date: 2020-06-15 01:29:36 UTC
  • mfrom: (7490.40.4 work)
  • mto: (7490.40.19 work)
  • mto: This revision was merged to the branch mainline in revision 7516.
  • Revision ID: jelmer@jelmer.uk-20200615012936-1adqbu592y7lzmy8
Merge upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
from ..remote import (
42
42
    split_git_url,
43
43
    parse_git_error,
 
44
    parse_git_hangup,
44
45
    HeadUpdateFailed,
45
46
    RemoteGitError,
46
47
    RemoteGitBranchFormat,
48
49
    )
49
50
 
50
51
from dulwich import porcelain
 
52
from dulwich.errors import HangupException
51
53
from dulwich.repo import Repo as GitRepo
52
54
 
53
55
 
144
146
        self.assertIsInstance(e, NotBranchError)
145
147
 
146
148
 
 
149
class ParseHangupTests(TestCase):
 
150
 
 
151
    def setUp(self):
 
152
        super(ParseHangupTests, self).setUp()
 
153
        try:
 
154
            HangupException(['foo'])
 
155
        except TypeError:
 
156
            self.skipTest('dulwich version too old')
 
157
 
 
158
    def test_not_set(self):
 
159
        self.assertIsInstance(
 
160
            parse_git_hangup('http://', HangupException()), HangupException)
 
161
 
 
162
    def test_single_line(self):
 
163
        self.assertEqual(
 
164
            RemoteGitError('foo bar'),
 
165
            parse_git_hangup('http://', HangupException(['foo bar'])))
 
166
 
 
167
    def test_multi_lines(self):
 
168
        self.assertEqual(
 
169
            RemoteGitError('foo bar\nbla bla'),
 
170
            parse_git_hangup(
 
171
                'http://', HangupException(['foo bar', 'bla bla'])))
 
172
 
 
173
    def test_filter_boring(self):
 
174
        self.assertEqual(
 
175
            RemoteGitError('foo bar'), parse_git_hangup('http://', HangupException(
 
176
                ['=======', 'foo bar', '======'])))
 
177
 
 
178
    def test_permission_denied(self):
 
179
        self.assertEqual(
 
180
            PermissionDenied('http://', 'You are not allowed to push code to this project.'),
 
181
            parse_git_hangup(
 
182
                'http://',
 
183
                HangupException(
 
184
                    ['=======',
 
185
                     'You are not allowed to push code to this project.', '', '======'])))
 
186
 
 
187
 
147
188
class TestRemoteGitBranchFormat(TestCase):
148
189
 
149
190
    def setUp(self):
567
608
        self.assertEqual(
568
609
            {'': 'master', 'blah': 'blah', 'master': 'master'},
569
610
            {n: b.name for (n, b) in remote.get_branches().items()})
 
611
        self.assertEqual(
 
612
            set(['', 'blah', 'master']), set(remote.branch_names()))
570
613
 
571
614
    def test_remove_tag(self):
572
615
        c1 = self.remote_real.do_commit(