コード例 #1
0
 def test_cred_seq_login_password(self):
     self.context['cred_list'] = ['mycred', 'default']
     login_handler(self.spawn, self.context, self.session)
     login_handler(self.spawn, self.context, self.session)
     password_handler(self.spawn, self.context, self.session)
     login_handler(self.spawn, self.context, self.session)
     password_handler(self.spawn, self.context, self.session)
     self.spawn.sendline.assert_has_calls(
         [call('admin'),
          call('cisco'),
          call('defun'),
          call('defpw')])
コード例 #2
0
 def test_password_failed(self):
     with self.assertRaisesRegex(CredentialsExhaustedError,
                                 '.*tried without success.*default'):
         login_handler(self.spawn, self.context, self.session)
         password_handler(self.spawn, self.context, self.session)
         password_handler(self.spawn, self.context, self.session)
コード例 #3
0
 def test_no_password_specified(self):
     self.context['credentials']['default'].pop('password')
     with self.assertRaisesRegex(UniconAuthenticationError,
                                 '.*No password.*default'):
         login_handler(self.spawn, self.context, self.session)
         password_handler(self.spawn, self.context, self.session)
コード例 #4
0
 def test_default_cred_sent_when_unknown_cred_given_with_login(self):
     self.context['cred_list'] = ['badcred']
     login_handler(self.spawn, self.context, self.session)
     password_handler(self.spawn, self.context, self.session)
     self.spawn.sendline.assert_has_calls([call('defun'), call('defpw')])
コード例 #5
0
 def test_default_cred_sent_if_no_creds_given_with_login(self):
     login_handler(self.spawn, self.context, self.session)
     password_handler(self.spawn, self.context, self.session)
     self.spawn.sendline.assert_has_calls([call('defun'), call('defpw')])