예제 #1
0
    def test_ca_cert_passed_as_env_var(self):
        self.useFixture(fixtures.EnvironmentVariable('OS_CACERT', CA_CERT))

        self.mox.StubOutWithMock(ClientManager, '__init__')
        self.mox.StubOutWithMock(openstack_shell.NeutronShell, 'interact')

        ClientManager.__init__(
            ca_cert=CA_CERT,
            # we are not really interested in other args
            api_version=mox.IgnoreArg(),
            auth_strategy=mox.IgnoreArg(),
            auth_url=mox.IgnoreArg(),
            endpoint_type=mox.IgnoreArg(),
            insecure=mox.IgnoreArg(),
            password=mox.IgnoreArg(),
            region_name=mox.IgnoreArg(),
            tenant_id=mox.IgnoreArg(),
            tenant_name=mox.IgnoreArg(),
            token=mox.IgnoreArg(),
            url=mox.IgnoreArg(),
            username=mox.IgnoreArg(),
            log_credentials=mox.IgnoreArg(),
        )
        openstack_shell.NeutronShell.interact().AndReturn(0)
        self.mox.ReplayAll()

        openstack_shell.NeutronShell('2.0').run([])
        self.mox.VerifyAll()
예제 #2
0
    def test_ca_cert_passed_as_env_var(self):
        self.useFixture(fixtures.EnvironmentVariable('OS_CACERT', CA_CERT))

        self.mox.StubOutWithMock(ClientManager, '__init__')
        self.mox.StubOutWithMock(openstack_shell.NeutronShell, 'interact')

        ClientManager.__init__(
            ca_cert=CA_CERT,
            # we are not really interested in other args
            api_version=mox.IgnoreArg(),
            auth_strategy=mox.IgnoreArg(),
            auth_url=mox.IgnoreArg(),
            service_type=mox.IgnoreArg(),
            endpoint_type=mox.IgnoreArg(),
            insecure=mox.IgnoreArg(),
            password=mox.IgnoreArg(),
            region_name=mox.IgnoreArg(),
            tenant_id=mox.IgnoreArg(),
            tenant_name=mox.IgnoreArg(),
            token=mox.IgnoreArg(),
            url=mox.IgnoreArg(),
            username=mox.IgnoreArg(),
            user_id=mox.IgnoreArg(),
            log_credentials=mox.IgnoreArg(),
            timeout=mox.IgnoreArg(),
        )
        openstack_shell.NeutronShell.interact().AndReturn(0)
        self.mox.ReplayAll()

        openstack_shell.NeutronShell('2.0').run([])
        self.mox.VerifyAll()
예제 #3
0
    def test_ca_cert_passed(self):
        self.mox.StubOutWithMock(ClientManager, '__init__')
        self.mox.StubOutWithMock(openstack_shell.NeutronShell, 'interact')

        ClientManager.__init__(
            ca_cert=CA_CERT,
            # we are not really interested in other args
            api_version=mox.IgnoreArg(),
            auth_strategy=mox.IgnoreArg(),
            auth_url=mox.IgnoreArg(),
            endpoint_type=mox.IgnoreArg(),
            insecure=mox.IgnoreArg(),
            password=mox.IgnoreArg(),
            region_name=mox.IgnoreArg(),
            tenant_id=mox.IgnoreArg(),
            tenant_name=mox.IgnoreArg(),
            token=mox.IgnoreArg(),
            url=mox.IgnoreArg(),
            username=mox.IgnoreArg(),
            log_credentials=mox.IgnoreArg(),
        )
        openstack_shell.NeutronShell.interact().AndReturn(0)
        self.mox.ReplayAll()

        openstack_shell.NeutronShell('2.0').run(['--os-cacert', CA_CERT])
        self.mox.VerifyAll()
예제 #4
0
    def test_client_manager_properly_creates_httpclient_instance(self):
        self.mox.StubOutWithMock(HTTPClient, '__init__')
        HTTPClient.__init__(
            ca_cert=CA_CERT,
            # we are not really interested in other args
            auth_strategy=mox.IgnoreArg(),
            auth_url=mox.IgnoreArg(),
            auth_plugin=mox.IgnoreArg(),
            endpoint_url=mox.IgnoreArg(),
            insecure=mox.IgnoreArg(),
            password=mox.IgnoreArg(),
            region_name=mox.IgnoreArg(),
            tenant_name=mox.IgnoreArg(),
            token=mox.IgnoreArg(),
            username=mox.IgnoreArg(),
            user_id=mox.IgnoreArg(),
            tenant_id=mox.IgnoreArg(),
            timeout=mox.IgnoreArg(),
            log_credentials=mox.IgnoreArg(),
            service_type=mox.IgnoreArg(),
            endpoint_type=mox.IgnoreArg())
        self.mox.ReplayAll()

        version = {'network': '2.0'}
        ClientManager(ca_cert=CA_CERT,
                      api_version=version,
                      url=END_URL,
                      token=AUTH_TOKEN).neutron
        self.mox.VerifyAll()
    def test_ca_cert_passed_as_env_var(self, mrequests):

        # emulate Keystone version discovery
        mrequests.register_uri('GET',
                               auth.V3_URL,
                               json=auth.V3_VERSION_ENTRY)

        self.useFixture(fixtures.EnvironmentVariable('OS_CACERT', CA_CERT))

        self.mox.StubOutWithMock(ClientManager, '__init__')
        self.mox.StubOutWithMock(openstack_shell.NeutronShell, 'interact')

        ClientManager.__init__(
            ca_cert=CA_CERT,
            # we are not really interested in other args
            api_version=mox.IgnoreArg(),
            auth_strategy=mox.IgnoreArg(),
            auth_url=mox.IgnoreArg(),
            service_type=mox.IgnoreArg(),
            endpoint_type=mox.IgnoreArg(),
            auth_plugin=mox.IgnoreArg(),
            insecure=mox.IgnoreArg(),
            password=mox.IgnoreArg(),
            region_name=mox.IgnoreArg(),
            tenant_id=mox.IgnoreArg(),
            tenant_name=mox.IgnoreArg(),
            token=mox.IgnoreArg(),
            url=mox.IgnoreArg(),
            username=mox.IgnoreArg(),
            user_id=mox.IgnoreArg(),
            retries=mox.IgnoreArg(),
            raise_errors=mox.IgnoreArg(),
            log_credentials=mox.IgnoreArg(),
            timeout=mox.IgnoreArg(),
            auth=mox.IgnoreArg(),
            session=mox.IgnoreArg()
        )
        openstack_shell.NeutronShell.interact().AndReturn(0)
        self.mox.ReplayAll()

        cmdline = ('--os-auth-url %s' % auth.V3_URL)
        openstack_shell.NeutronShell('2.0').run(cmdline.split())

        self.mox.VerifyAll()
예제 #6
0
    def test_ca_cert_passed_as_env_var(self):

        # emulate Keystone version discovery
        httpretty.register_uri(httpretty.GET,
                               auth.V3_URL,
                               body=auth.V3_VERSION_ENTRY)

        self.useFixture(fixtures.EnvironmentVariable('OS_CACERT', CA_CERT))

        self.mox.StubOutWithMock(ClientManager, '__init__')
        self.mox.StubOutWithMock(openstack_shell.NeutronShell, 'interact')

        ClientManager.__init__(
            ca_cert=CA_CERT,
            # we are not really interested in other args
            api_version=mox.IgnoreArg(),
            auth_strategy=mox.IgnoreArg(),
            auth_url=mox.IgnoreArg(),
            service_type=mox.IgnoreArg(),
            endpoint_type=mox.IgnoreArg(),
            insecure=mox.IgnoreArg(),
            password=mox.IgnoreArg(),
            region_name=mox.IgnoreArg(),
            tenant_id=mox.IgnoreArg(),
            tenant_name=mox.IgnoreArg(),
            token=mox.IgnoreArg(),
            url=mox.IgnoreArg(),
            username=mox.IgnoreArg(),
            user_id=mox.IgnoreArg(),
            retries=mox.IgnoreArg(),
            raise_errors=mox.IgnoreArg(),
            log_credentials=mox.IgnoreArg(),
            timeout=mox.IgnoreArg(),
            auth=mox.IgnoreArg(),
            session=mox.IgnoreArg())
        openstack_shell.NeutronShell.interact().AndReturn(0)
        self.mox.ReplayAll()

        cmdline = ('--os-auth-url %s' % auth.V3_URL)
        openstack_shell.NeutronShell('2.0').run(cmdline.split())

        self.mox.VerifyAll()
예제 #7
0
    def test_ca_cert_passed(self):
        # emulate Keystone version discovery
        httpretty.register_uri(httpretty.GET,
                               auth.V3_URL,
                               body=auth.V3_VERSION_ENTRY)

        self.mox.StubOutWithMock(ClientManager, '__init__')
        self.mox.StubOutWithMock(openstack_shell.NeutronShell, 'interact')

        ClientManager.__init__(
            ca_cert=CA_CERT,
            # we are not really interested in other args
            api_version=mox.IgnoreArg(),
            auth_strategy=mox.IgnoreArg(),
            auth_url=mox.IgnoreArg(),
            service_type=mox.IgnoreArg(),
            endpoint_type=mox.IgnoreArg(),
            insecure=mox.IgnoreArg(),
            password=mox.IgnoreArg(),
            region_name=mox.IgnoreArg(),
            tenant_id=mox.IgnoreArg(),
            tenant_name=mox.IgnoreArg(),
            token=mox.IgnoreArg(),
            url=mox.IgnoreArg(),
            username=mox.IgnoreArg(),
            user_id=mox.IgnoreArg(),
            retries=mox.IgnoreArg(),
            raise_errors=mox.IgnoreArg(),
            log_credentials=mox.IgnoreArg(),
            timeout=mox.IgnoreArg(),
            auth=mox.IgnoreArg(),
            session=mox.IgnoreArg()
        )
        openstack_shell.NeutronShell.interact().AndReturn(0)
        self.mox.ReplayAll()

        cmdline = (
            '--os-cacert %s --os-auth-url %s' %
            (CA_CERT, auth.V3_URL))

        openstack_shell.NeutronShell('2.0').run(cmdline.split())
        self.mox.VerifyAll()
예제 #8
0
    def test_ca_cert_passed(self, mrequests):
        # emulate Keystone version discovery
        mrequests.register_uri('GET', auth.V3_URL, json=auth.V3_VERSION_ENTRY)

        self.mox.StubOutWithMock(ClientManager, '__init__')
        self.mox.StubOutWithMock(openstack_shell.NeutronShell, 'interact')

        ClientManager.__init__(
            ca_cert=CA_CERT,
            # we are not really interested in other args
            api_version=mox.IgnoreArg(),
            auth_strategy=mox.IgnoreArg(),
            auth_url=mox.IgnoreArg(),
            auth_plugin=mox.IgnoreArg(),
            service_type=mox.IgnoreArg(),
            endpoint_type=mox.IgnoreArg(),
            insecure=mox.IgnoreArg(),
            password=mox.IgnoreArg(),
            region_name=mox.IgnoreArg(),
            tenant_id=mox.IgnoreArg(),
            tenant_name=mox.IgnoreArg(),
            token=mox.IgnoreArg(),
            url=mox.IgnoreArg(),
            username=mox.IgnoreArg(),
            user_id=mox.IgnoreArg(),
            retries=mox.IgnoreArg(),
            raise_errors=mox.IgnoreArg(),
            log_credentials=mox.IgnoreArg(),
            timeout=mox.IgnoreArg(),
            auth=mox.IgnoreArg(),
            session=mox.IgnoreArg())
        openstack_shell.NeutronShell.interact().AndReturn(0)
        self.mox.ReplayAll()

        cmdline = ('--os-cacert %s --os-auth-url %s' % (CA_CERT, auth.V3_URL))

        openstack_shell.NeutronShell('2.0').run(cmdline.split())
        self.mox.VerifyAll()