示例#1
0
 def test_infrastructure_keys_driver(self, infrastructure_keys_driver_init):
     session = LmSession(
         LmSessionConfig(LmEnvironment('lm', 'test', 80, 'https'), None))
     driver = session.infrastructure_keys_driver
     infrastructure_keys_driver_init.assert_called_once_with(
         'https://test:80', None)
     self.assertEqual(driver, infrastructure_keys_driver_init.return_value)
示例#2
0
 def test_deployment_location_driver(self, deployment_location_driver_init):
     session = LmSession(
         LmSessionConfig(LmEnvironment('lm', 'test', 80, 'https'), None))
     driver = session.deployment_location_driver
     deployment_location_driver_init.assert_called_once_with(
         'https://test:80', None)
     self.assertEqual(driver, deployment_location_driver_init.return_value)
示例#3
0
 def test_init(self):
     env = LmEnvironment('lm',
                         'test',
                         80,
                         'https',
                         secure=True,
                         username='******',
                         password='******')
     session_config = env.create_session_config()
     session = LmSession(session_config)
     self.assertEqual(session.env, env)
     self.assertEqual(session.username, 'user')
     self.assertEqual(session.password, 'secret')
示例#4
0
 def test_infrastructure_keys_driver_with_security(
         self, infrastructure_keys_driver_init, mock_security_ctrl_init):
     session = LmSession(
         LmSessionConfig(
             LmEnvironment('lm',
                           'test',
                           80,
                           'https',
                           secure=True,
                           username='******',
                           auth_host='auth',
                           auth_port=81,
                           auth_protocol='http'), 'user', 'secret'))
     driver = session.infrastructure_keys_driver
     mock_security_ctrl_init.assert_called_once_with(
         'http://auth:81', 'user', 'secret')
     infrastructure_keys_driver_init.assert_called_once_with(
         'https://test:80', mock_security_ctrl_init.return_value)
     self.assertEqual(driver, infrastructure_keys_driver_init.return_value)
示例#5
0
 def test_behaviour_driver(self, behaviour_driver_init):
     session = LmSession(
         LmSessionConfig(LmEnvironment('lm', 'test', 80, 'https'), None))
     driver = session.behaviour_driver
     behaviour_driver_init.assert_called_once_with('https://test:80', None)
     self.assertEqual(driver, behaviour_driver_init.return_value)
示例#6
0
 def test_init_fails_without_config(self):
     with self.assertRaises(EnvironmentConfigError) as context:
         LmSession(None)
     self.assertEqual(str(context.exception),
                      'config not provided to session')