144
142
self.assertIsInstance(e, NotBranchError)
146
def test_invalid_git_error(self):
150
'GitLab: You are not allowed to push code to protected '
151
'branches on this project.'),
155
'GitLab: You are not allowed to push code to '
156
'protected branches on this project.')))
159
class ParseHangupTests(TestCase):
162
super(ParseHangupTests, self).setUp()
164
HangupException([b'foo'])
166
self.skipTest('dulwich version too old')
168
def test_not_set(self):
169
self.assertIsInstance(
170
parse_git_hangup('http://', HangupException()), HangupException)
172
def test_single_line(self):
174
RemoteGitError('foo bar'),
175
parse_git_hangup('http://', HangupException([b'foo bar'])))
177
def test_multi_lines(self):
179
RemoteGitError('foo bar\nbla bla'),
181
'http://', HangupException([b'foo bar', b'bla bla'])))
183
def test_filter_boring(self):
185
RemoteGitError('foo bar'), parse_git_hangup('http://', HangupException(
186
[b'=======', b'foo bar', b'======'])))
188
RemoteGitError('foo bar'), parse_git_hangup('http://', HangupException(
189
[b'remote: =======', b'remote: foo bar', b'remote: ======'])))
191
def test_permission_denied(self):
193
PermissionDenied('http://', 'You are not allowed to push code to this project.'),
198
b'You are not allowed to push code to this project.', b'', b'======'])))
201
145
class TestRemoteGitBranchFormat(TestCase):