Beispiel #1
0
 def test_onto_transport_unauthenticated(self):
     """An unauthenticated request is transmitted across a mock Transport"""
     transport = InstrumentedXMLRPCTransport(self, expect_auth=False)
     service = LaunchpadService(transport)
     resolve = ResolveLaunchpadPathRequest('bzr')
     resolve.submit(service)
     self.assertEquals(transport.connected_host, 'xmlrpc.launchpad.net')
     self.assertEquals(len(transport.sent_params), 1)
     self.assertEquals(transport.sent_params, ('bzr', ))
     self.assertTrue(transport.got_request)
Beispiel #2
0
 def test_mock_resolve_lp_url(self):
     test_case = self
     class MockService(MockLaunchpadService):
         def send_request(self, method_name, method_params, authenticated):
             test_case.assertEquals(method_name, "resolve_lp_path")
             test_case.assertEquals(list(method_params), ['bzr'])
             test_case.assertEquals(authenticated, False)
             return dict(urls=[
                     'bzr+ssh://bazaar.launchpad.net~bzr/bzr/trunk',
                     'sftp://bazaar.launchpad.net~bzr/bzr/trunk',
                     'bzr+http://bazaar.launchpad.net~bzr/bzr/trunk',
                     'http://bazaar.launchpad.net~bzr/bzr/trunk'])
     service = MockService()
     resolve = ResolveLaunchpadPathRequest('bzr')
     result = resolve.submit(service)
     self.assertTrue('urls' in result)
     self.assertEquals(result['urls'], [
             'bzr+ssh://bazaar.launchpad.net~bzr/bzr/trunk',
             'sftp://bazaar.launchpad.net~bzr/bzr/trunk',
             'bzr+http://bazaar.launchpad.net~bzr/bzr/trunk',
             'http://bazaar.launchpad.net~bzr/bzr/trunk'])