Ejemplo n.º 1
0
    def test_get_muranoclient_without_urls(self, mock_glare_client,
                                           mock_muranoclient, mock_log):
        self._override_conf(without_urls=True)

        m_artifacts_client = mock.Mock()
        m_muranoclient = mock.Mock()
        mock_glare_client.Client.return_value = m_artifacts_client
        mock_muranoclient.Client.return_value = m_muranoclient
        mock_request = mock.Mock(endpoints={'murano': None})

        client = api._get_muranoclient(mock.sentinel.token_id, mock_request)

        self.assertEqual(m_muranoclient, client)
        mock_glare_client.Client.assert_called_once_with(
            endpoint=None,
            token=mock.sentinel.token_id,
            insecure=True,
            key_file='foo_key_file',
            ca_file='foo_ca_file',
            cert_file='foo_cert_file',
            type_name='murano',
            type_version=1)
        mock_muranoclient.Client.assert_called_once_with(
            1,
            None,
            token=mock.sentinel.token_id,
            artifacts_client=m_artifacts_client)
        mock_log.error.assert_has_calls([
            mock.call('No glare url is specified and no "artifact" '
                      'service is registered in keystone.'),
            mock.call('No murano url is specified and no '
                      '"application-catalog" service is registered in '
                      'keystone.')
        ])
Ejemplo n.º 2
0
    def test_get_muranoclient(self, mock_glare_client, mock_muranoclient):
        self._override_conf()

        m_artifacts_client = mock.Mock()
        m_muranoclient = mock.Mock()
        mock_glare_client.Client.return_value = m_artifacts_client
        mock_muranoclient.Client.return_value = m_muranoclient

        client = api._get_muranoclient(mock.sentinel.token_id, None)

        self.assertEqual(m_muranoclient, client)
        mock_glare_client.Client.assert_called_once_with(
            endpoint='foo_glare_url',
            token=mock.sentinel.token_id,
            insecure=True,
            key_file='foo_key_file',
            ca_file='foo_ca_file',
            cert_file='foo_cert_file',
            type_name='murano',
            type_version=1)
        mock_muranoclient.Client.assert_called_once_with(
            1,
            'foo_murano_url',
            token=mock.sentinel.token_id,
            artifacts_client=m_artifacts_client)