/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: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-06-11 16:46:46 UTC
  • mfrom: (7512.1.1 drop-travis-appveyor)
  • Revision ID: breezy.the.bot@gmail.com-20200611164646-w4tufva3jchfv1mn
Drop appveyor + travis configuration.

Merged from https://code.launchpad.net/~jelmer/brz/drop-travis-appveyor/+merge/385578

Show diffs side-by-side

added added

removed removed

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