Esempio n. 1
0
    def test_create_connection(self, mock_conn, mock_profile):
        x_profile = mock.Mock()
        mock_profile.return_value = x_profile
        x_conn = mock.Mock()
        mock_conn.return_value = x_conn

        res = sdk.create_connection({'foo': 'bar'})

        self.assertEqual(x_conn, res)
        mock_profile.assert_called_once_with()
        mock_conn.assert_called_once_with(profile=x_profile,
                                          user_agent=sdk.USER_AGENT,
                                          foo='bar')
Esempio n. 2
0
    def test_create_connection_with_region(self, mock_conn, mock_profile):
        x_profile = mock.Mock()
        mock_profile.return_value = x_profile
        x_conn = mock.Mock()
        mock_conn.return_value = x_conn

        res = sdk.create_connection({'region_name': 'REGION_ONE'})

        self.assertEqual(x_conn, res)
        mock_profile.assert_called_once_with()
        x_profile.set_region.assert_called_once_with(x_profile.ALL,
                                                     'REGION_ONE')
        mock_conn.assert_called_once_with(profile=x_profile,
                                          user_agent=sdk.USER_AGENT)
Esempio n. 3
0
    def test_create_connection_token(self, mock_conn, mock_profile):
        x_profile = mock.Mock()
        mock_profile.return_value = x_profile
        x_conn = mock.Mock()
        mock_conn.return_value = x_conn

        res = sdk.create_connection({'token': 'TOKEN', 'foo': 'bar'})

        self.assertEqual(x_conn, res)
        mock_profile.assert_called_once_with()
        x_profile.set_version.assert_called_once_with('identity', 'v3')
        mock_conn.assert_called_once_with(profile=x_profile,
                                          user_agent=sdk.USER_AGENT,
                                          auth_plugin='token',
                                          token='TOKEN',
                                          foo='bar')
Esempio n. 4
0
    def test_create_connection_token(self, mock_conn, mock_profile):
        x_profile = mock.Mock()
        mock_profile.return_value = x_profile
        x_conn = mock.Mock()
        mock_conn.return_value = x_conn

        res = sdk.create_connection({'token': 'TOKEN', 'foo': 'bar'})

        self.assertEqual(x_conn, res)
        mock_profile.assert_called_once_with()
        x_profile.set_version.assert_called_once_with('identity', 'v3')
        mock_conn.assert_called_once_with(profile=x_profile,
                                          user_agent=sdk.USER_AGENT,
                                          auth_plugin='token',
                                          token='TOKEN',
                                          foo='bar')
Esempio n. 5
0
    def test_create_connection_password(self, mock_conn, mock_profile):
        x_profile = mock.Mock()
        mock_profile.return_value = x_profile
        x_conn = mock.Mock()
        mock_conn.return_value = x_conn

        res = sdk.create_connection({'user_id': '123', 'password': '******',
                                     'foo': 'bar'})

        self.assertEqual(x_conn, res)
        mock_profile.assert_called_once_with()
        x_profile.set_version.assert_called_once_with('identity', 'v3')
        mock_conn.assert_called_once_with(profile=x_profile,
                                          user_agent=sdk.USER_AGENT,
                                          auth_plugin='password',
                                          user_id='123',
                                          password='******',
                                          foo='bar')
Esempio n. 6
0
    def test_create_connection_password(self, mock_conn, mock_profile):
        x_profile = mock.Mock()
        mock_profile.return_value = x_profile
        x_conn = mock.Mock()
        mock_conn.return_value = x_conn

        res = sdk.create_connection({'user_id': '123', 'password': '******',
                                     'foo': 'bar'})

        self.assertEqual(x_conn, res)
        mock_profile.assert_called_once_with()
        x_profile.set_version.assert_called_once_with('identity', 'v3')
        mock_conn.assert_called_once_with(profile=x_profile,
                                          user_agent=sdk.USER_AGENT,
                                          auth_plugin='password',
                                          user_id='123',
                                          password='******',
                                          foo='bar')
Esempio n. 7
0
 def __init__(self, params):
     super(NovaClient, self).__init__(params)
     self.conn = sdk.create_connection(params)
     self.session = self.conn.session
Esempio n. 8
0
 def __init__(self, params):
     super(NeutronClient, self).__init__(params)
     self.conn = sdk.create_connection(params)
Esempio n. 9
0
 def __init__(self, params):
     super(CeilometerClient, self).__init__(params)
     self.conn = sdk.create_connection(params)
Esempio n. 10
0
 def __init__(self, params):
     super(NeutronClient, self).__init__(params)
     self.conn = sdk.create_connection(params)
Esempio n. 11
0
 def __init__(self, params):
     super(NovaClient, self).__init__(params)
     self.conn = sdk.create_connection(params)
     self.session = self.conn.session