/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-12 01:45:56 UTC
  • mfrom: (7513.1.2 pypy3)
  • Revision ID: breezy.the.bot@gmail.com-20200612014556-tsc8assk3d0luziu
Avoid deprecated behaviour in ElementTree.

Merged from https://code.launchpad.net/~jelmer/brz/pypy3/+merge/385611

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Test the smart client."""
18
18
 
19
 
from __future__ import absolute_import
20
 
 
21
19
from io import BytesIO
22
20
 
23
21
import os
41
39
from ..remote import (
42
40
    split_git_url,
43
41
    parse_git_error,
 
42
    parse_git_hangup,
44
43
    HeadUpdateFailed,
45
44
    RemoteGitError,
46
45
    RemoteGitBranchFormat,
48
47
    )
49
48
 
50
49
from dulwich import porcelain
 
50
from dulwich.errors import HangupException
51
51
from dulwich.repo import Repo as GitRepo
52
52
 
53
53
 
144
144
        self.assertIsInstance(e, NotBranchError)
145
145
 
146
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
 
147
186
class TestRemoteGitBranchFormat(TestCase):
148
187
 
149
188
    def setUp(self):