135
133
self.assertEqual(e.path, 'porridge/gaduhistory.git')
136
134
self.assertEqual(e.extra, ': denied to jelmer')
138
def test_pre_receive_hook_declined(self):
141
'pre-receive hook declined')
142
self.assertIsInstance(e, PermissionDenied)
143
self.assertEqual(e.path, "url")
144
self.assertEqual(e.extra, ': pre-receive hook declined')
146
136
def test_invalid_repo_name(self):
147
137
e = parse_git_error(
152
142
self.assertIsInstance(e, NotBranchError)
154
def test_invalid_git_error(self):
158
'GitLab: You are not allowed to push code to protected '
159
'branches on this project.'),
163
'GitLab: You are not allowed to push code to '
164
'protected branches on this project.')))
167
class ParseHangupTests(TestCase):
170
super(ParseHangupTests, self).setUp()
172
HangupException([b'foo'])
174
self.skipTest('dulwich version too old')
176
def test_not_set(self):
177
self.assertIsInstance(
178
parse_git_hangup('http://', HangupException()), HangupException)
180
def test_single_line(self):
182
RemoteGitError('foo bar'),
183
parse_git_hangup('http://', HangupException([b'foo bar'])))
185
def test_multi_lines(self):
187
RemoteGitError('foo bar\nbla bla'),
189
'http://', HangupException([b'foo bar', b'bla bla'])))
191
def test_filter_boring(self):
193
RemoteGitError('foo bar'), parse_git_hangup('http://', HangupException(
194
[b'=======', b'foo bar', b'======'])))
196
RemoteGitError('foo bar'), parse_git_hangup('http://', HangupException(
197
[b'remote: =======', b'remote: foo bar', b'remote: ======'])))
199
def test_permission_denied(self):
201
PermissionDenied('http://', 'You are not allowed to push code to this project.'),
206
b'You are not allowed to push code to this project.', b'', b'======'])))
209
145
class TestRemoteGitBranchFormat(TestCase):