Exemplo n.º 1
0
    def test_create_client(self, create, get_url):
        get_url.return_value = self._public_url

        client_config = cfg.CONF[glance.CONFIG_GROUP]
        client_version = glance.GLANCECLIENT_VERSION
        session = object()
        args = {
            'endpoint': self._public_url,
            'token': self._context.auth_token,
            'cacert': client_config.glance_ca_cert_file,
            'insecure': client_config.glance_auth_insecure,
        }

        glance.create(self._context, cfg.CONF)
        create.assert_called_with(client_version, **args)

        glance.create(self._context, cfg.CONF, session=session)
        create.assert_called_with(client_version,
                                  endpoint=self._public_url,
                                  session=session)
Exemplo n.º 2
0
 def test_create_client_by_catalog(self):
     gc = glance.create(self._context, cfg.CONF)
     self.assertEqual('http://127.0.0.1:9292', gc.http_client.endpoint)
Exemplo n.º 3
0
 def test_create_client_by_catalog(self):
     gc = glance.create(self._context, cfg.CONF)
     self.assertEqual("http://127.0.0.1:9292", gc.http_client.endpoint)
Exemplo n.º 4
0
 def test_create_client_by_endpoint(self):
     cfg.CONF.set_default('glance_endpoint', 'http://127.0.0.1:9292',
                          'glance_client')
     gc = glance.create(self._context, cfg.CONF)
     self.assertEqual('http://127.0.0.1:9292', gc.http_client.endpoint)
Exemplo n.º 5
0
 def test_create_client_by_endpoint(self):
     cfg.CONF.set_default("glance_endpoint", "http://127.0.0.1:9292", "glance_client")
     gc = glance.create(self._context, cfg.CONF)
     self.assertEqual("http://127.0.0.1:9292", gc.http_client.endpoint)