Exemple #1
0
 def testRbuilderRPCClientInit(self):
     mock.mock(fac_mod, 'ServerProxy')
     rbuilderfacade.RbuilderRPCClient('http://localhost', 'foo', 'bar',
                                      None)
     fac_mod.ServerProxy._mock.assertCalled(
         'http://localhost/xmlrpc-private', username='******', password='******')
     rbuilderfacade.RbuilderRPCClient('https://localhost2', 'foo2', 'bar',
                                      None)
     fac_mod.ServerProxy._mock.assertCalled(
         'https://localhost2/xmlrpc-private',
         username='******',
         password='******')
Exemple #2
0
 def testValidateCredentials(self):
     handle, facade = self.prep()
     mock.mock(rbuilderfacade, 'RbuilderRPCClient')
     rbuilderfacade.RbuilderRPCClient().checkAuth._mock.setDefaultReturn(
         dict(authorized=True))
     rbuilderfacade.RbuilderRPCClient._mock.popCall()
     auth = facade.validateCredentials('user', 'pass', 'http://foo')
     assert (auth is True)
     self.assertEquals(rbuilderfacade.RbuilderRPCClient._mock.popCall(),
                       (('http://foo', 'user', 'pass', handle), ()))
     rbuilderfacade.RbuilderRPCClient().checkAuth._mock.setDefaultReturn(
         dict())
     auth = facade.validateCredentials('user', 'pass', 'http://foo')
     assert (auth is False)
Exemple #3
0
 def testValidateRbuilderUrl(self):
     handle, facade = self.prep()
     mock.mock(rbuilderfacade, 'RbuilderRPCClient')
     rbuilderfacade.RbuilderRPCClient().checkAuth._mock.setDefaultReturn(
         dict(authorized=True))
     rbuilderfacade.RbuilderRPCClient._mock.popCall()
     ret = facade.validateRbuilderUrl('http://foo')
     self.assertEquals(rbuilderfacade.RbuilderRPCClient._mock.popCall(),
                       (('http://foo', '', '', handle), ()))
     assert ((True, '') == ret)
     e = Exception()
     rbuilderfacade.RbuilderRPCClient().checkAuth._mock.raiseErrorOnAccess(
         e)
     ret = facade.validateRbuilderUrl('http://foo')
     assert ((False, e) == ret)
Exemple #4
0
 def _getClient(self):
     mock.mock(fac_mod, 'ServerProxy')
     return rbuilderfacade.RbuilderRPCClient('http://localhost', 'foo',
                                             'bar', mock.MockObject())