Exemple #1
0
 def setUp(self):
     self.controller = controller.Controller()
     self.mock = mox.Mox()
     self.credential = credential.Credential(regexp='.*',
                                             connect_method='foo')
     # Refactor abstract Credentials class so it can be initialised
     # without content.
     self.controller.credentials = credential.Credentials('')
     self.controller.credentials.credentials = [
         credential.Credential(regexp='.*',
                               username='******',
                               password='******')
     ]
Exemple #2
0
    def testRegexpWithAnchoredString(self):
        cred = credential.Credential(regexp='^ar1.*$',
                                     username='******',
                                     password='******')
        match = cred.regexp.match('ar1.foo')
        self.assert_(match is not None)
        match = cred.regexp.match('car1.foo')
        self.assert_(match is None)

        self.assertEqual(cred.matches('ar1.foo'), True)
        self.assertEqual(cred.matches('car1.foo'), False)
        self.assertEqual(cred.matches('abc2'), False)
Exemple #3
0
 def setUp(self):
     self.mock = mox.Mox()
     self.credential = credential.Credential(regexp='.*',
                                             connect_method='foo')
Exemple #4
0
 def setUp(self):
     self.device = device.Device(name='test1.popname', addresses='10.0.0.1')
     self.credential = credential.Credential(regexp='.*',
                                             connect_method='foo')
     self.session = session.Session(device=self.device)
     self.session.credential = self.credential