def test_get_session(self):
        mock_ka_loading = self._init_mock_cfg(True)

        session = auth_utils._get_session(mock.sentinel.auth)

        self.assertEqual(mock.sentinel.session, session)
        mock_ka_loading.load_session_from_conf_options.\
            assert_called_once_with(auth=mock.sentinel.auth,
                                    conf=cfg.CONF,
                                    group=auth_utils.CFG_MURANO_AUTH_GROUP)
Example #2
0
    def test_get_session(self, mock_get_config_option):
        mock_cfg, mock_ka_loading = self._init_mock_cfg(True)
        mock_cfg.CONF.__getitem__.return_value = mock.sentinel.conf_section
        mock_get_config_option.side_effect = [
            mock.sentinel.secure_option,
            mock.sentinel.cacert_option,
            mock.sentinel.keyfile_option,
            mock.sentinel.cert_option,
        ]

        session = auth_utils._get_session(mock.sentinel.auth, None)

        self.assertEqual(mock.sentinel.session, session)
        mock_ka_loading.session.Session.return_value.load_from_options.\
            assert_called_once_with(auth=mock.sentinel.auth,
                                    insecure=mock.sentinel.secure_option,
                                    cacert=mock.sentinel.cacert_option,
                                    key=mock.sentinel.keyfile_option,
                                    cert=mock.sentinel.cert_option)