240
240
service.registrant_password = ''
241
241
request = DummyRequest()
242
242
request.submit(service)
243
self.assertEquals(service.called_method_name, 'dummy_request')
244
self.assertEquals(service.called_method_params, (42,))
243
self.assertEqual(service.called_method_name, 'dummy_request')
244
self.assertEqual(service.called_method_params, (42,))
246
246
def test_mock_server_registration(self):
247
247
"""Send registration to mock server"""
249
249
class MockRegistrationService(MockLaunchpadService):
250
250
def send_request(self, method_name, method_params, authenticated):
251
test_case.assertEquals(method_name, "register_branch")
252
test_case.assertEquals(list(method_params),
251
test_case.assertEqual(method_name, "register_branch")
252
test_case.assertEqual(list(method_params),
253
253
['url', 'name', 'title', 'description', 'email', 'name'])
254
test_case.assertEquals(authenticated, True)
254
test_case.assertEqual(authenticated, True)
256
256
service = MockRegistrationService()
257
257
rego = BranchRegistrationRequest('url', 'name', 'title',
258
258
'description', 'email', 'name')
259
259
result = rego.submit(service)
260
self.assertEquals(result, 'result')
260
self.assertEqual(result, 'result')
262
262
def test_mock_server_registration_with_defaults(self):
263
263
"""Send registration to mock server"""
265
265
class MockRegistrationService(MockLaunchpadService):
266
266
def send_request(self, method_name, method_params, authenticated):
267
test_case.assertEquals(method_name, "register_branch")
268
test_case.assertEquals(list(method_params),
267
test_case.assertEqual(method_name, "register_branch")
268
test_case.assertEqual(list(method_params),
269
269
['http://server/branch', 'branch', '', '', '', ''])
270
test_case.assertEquals(authenticated, True)
270
test_case.assertEqual(authenticated, True)
272
272
service = MockRegistrationService()
273
273
rego = BranchRegistrationRequest('http://server/branch')
274
274
result = rego.submit(service)
275
self.assertEquals(result, 'result')
275
self.assertEqual(result, 'result')
277
277
def test_mock_bug_branch_link(self):
278
278
"""Send bug-branch link to mock server"""
280
280
class MockService(MockLaunchpadService):
281
281
def send_request(self, method_name, method_params, authenticated):
282
test_case.assertEquals(method_name, "link_branch_to_bug")
283
test_case.assertEquals(list(method_params),
282
test_case.assertEqual(method_name, "link_branch_to_bug")
283
test_case.assertEqual(list(method_params),
284
284
['http://server/branch', 1234, ''])
285
test_case.assertEquals(authenticated, True)
285
test_case.assertEqual(authenticated, True)
286
286
return 'http://launchpad.net/bug/1234'
287
287
service = MockService()
288
288
rego = BranchBugLinkRequest('http://server/branch', 1234)
289
289
result = rego.submit(service)
290
self.assertEquals(result, 'http://launchpad.net/bug/1234')
290
self.assertEqual(result, 'http://launchpad.net/bug/1234')
292
292
def test_mock_resolve_lp_url(self):
294
294
class MockService(MockLaunchpadService):
295
295
def send_request(self, method_name, method_params, authenticated):
296
test_case.assertEquals(method_name, "resolve_lp_path")
297
test_case.assertEquals(list(method_params), ['bzr'])
298
test_case.assertEquals(authenticated, False)
296
test_case.assertEqual(method_name, "resolve_lp_path")
297
test_case.assertEqual(list(method_params), ['bzr'])
298
test_case.assertEqual(authenticated, False)
299
299
return dict(urls=[
300
300
'bzr+ssh://bazaar.launchpad.net~bzr/bzr/trunk',
301
301
'sftp://bazaar.launchpad.net~bzr/bzr/trunk',