Beispiel #1
0
 def test__get_cinder_session(self, mock_keystone_session):
     """Check establishing new session when no session exists."""
     mock_keystone_session.return_value = 'session1'
     self.assertEqual('session1', cinder._get_cinder_session())
     mock_keystone_session.assert_called_once_with('cinder')
     """Check if existing session is used."""
     mock_keystone_session.reset_mock()
     mock_keystone_session.return_value = 'session2'
     self.assertEqual('session1', cinder._get_cinder_session())
     self.assertFalse(mock_keystone_session.called)
Beispiel #2
0
    def test__get_cinder_session(self, mock_keystone_session, mock_auth):
        """Check establishing new session when no session exists."""
        mock_keystone_session.return_value = 'session1'
        self.assertEqual('session1', cinder._get_cinder_session())
        mock_keystone_session.assert_called_once_with('cinder')

        """Check if existing session is used."""
        mock_keystone_session.reset_mock()
        mock_keystone_session.return_value = 'session2'
        self.assertEqual('session1', cinder._get_cinder_session())
        self.assertFalse(mock_keystone_session.called)
        self.assertFalse(mock_auth.called)