Merge "Set identity v3 client in networkv2 fake"
This commit is contained in:
commit
d20d97fd09
@ -17,6 +17,7 @@ import mock
|
||||
import uuid
|
||||
|
||||
from openstackclient.tests import fakes
|
||||
from openstackclient.tests.identity.v3 import fakes as identity_fakes_v3
|
||||
from openstackclient.tests import utils
|
||||
|
||||
|
||||
@ -57,6 +58,13 @@ class TestNetworkV2(utils.TestCommand):
|
||||
token=fakes.AUTH_TOKEN,
|
||||
)
|
||||
|
||||
self.app.client_manager.identity = (
|
||||
identity_fakes_v3.FakeIdentityv3Client(
|
||||
endpoint=fakes.AUTH_URL,
|
||||
token=fakes.AUTH_TOKEN,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class FakeAddressScope(object):
|
||||
"""Fake one or more address scopes."""
|
||||
|
@ -17,7 +17,6 @@ from mock import call
|
||||
from osc_lib import exceptions
|
||||
|
||||
from openstackclient.network.v2 import address_scope
|
||||
from openstackclient.tests import fakes
|
||||
from openstackclient.tests.identity.v3 import fakes as identity_fakes_v3
|
||||
from openstackclient.tests.network.v2 import fakes as network_fakes
|
||||
from openstackclient.tests import utils as tests_utils
|
||||
@ -30,6 +29,10 @@ class TestAddressScope(network_fakes.TestNetworkV2):
|
||||
|
||||
# Get a shortcut to the network client
|
||||
self.network = self.app.client_manager.network
|
||||
# Get a shortcut to the ProjectManager Mock
|
||||
self.projects_mock = self.app.client_manager.identity.projects
|
||||
# Get a shortcut to the DomainManager Mock
|
||||
self.domains_mock = self.app.client_manager.identity.domains
|
||||
|
||||
|
||||
class TestCreateAddressScope(TestAddressScope):
|
||||
@ -66,20 +69,7 @@ class TestCreateAddressScope(TestAddressScope):
|
||||
# Get the command object to test
|
||||
self.cmd = address_scope.CreateAddressScope(self.app, self.namespace)
|
||||
|
||||
# Set identity client v3. And get a shortcut to Identity client.
|
||||
identity_client = identity_fakes_v3.FakeIdentityv3Client(
|
||||
endpoint=fakes.AUTH_URL,
|
||||
token=fakes.AUTH_TOKEN,
|
||||
)
|
||||
self.app.client_manager.identity = identity_client
|
||||
self.identity = self.app.client_manager.identity
|
||||
|
||||
# Get a shortcut to the ProjectManager Mock
|
||||
self.projects_mock = self.identity.projects
|
||||
self.projects_mock.get.return_value = self.project
|
||||
|
||||
# Get a shortcut to the DomainManager Mock
|
||||
self.domains_mock = self.identity.domains
|
||||
self.domains_mock.get.return_value = self.domain
|
||||
|
||||
def test_create_no_options(self):
|
||||
|
@ -16,7 +16,6 @@ import mock
|
||||
from osc_lib import utils as common_utils
|
||||
|
||||
from openstackclient.network.v2 import ip_availability
|
||||
from openstackclient.tests import fakes
|
||||
from openstackclient.tests.identity.v3 import fakes as identity_fakes
|
||||
from openstackclient.tests.network.v2 import fakes as network_fakes
|
||||
from openstackclient.tests import utils as tests_utils
|
||||
@ -30,16 +29,9 @@ class TestIPAvailability(network_fakes.TestNetworkV2):
|
||||
# Get a shortcut to the network client
|
||||
self.network = self.app.client_manager.network
|
||||
|
||||
# Set identity client v3. And get a shortcut to Identity client.
|
||||
identity_client = identity_fakes.FakeIdentityv3Client(
|
||||
endpoint=fakes.AUTH_URL,
|
||||
token=fakes.AUTH_TOKEN,
|
||||
)
|
||||
self.app.client_manager.identity = identity_client
|
||||
self.identity = self.app.client_manager.identity
|
||||
|
||||
# Get a shortcut to the ProjectManager Mock
|
||||
self.projects_mock = self.identity.projects
|
||||
self.projects_mock = self.app.client_manager.identity.projects
|
||||
|
||||
self.project = identity_fakes.FakeProject.create_one_project()
|
||||
self.projects_mock.get.return_value = self.project
|
||||
|
||||
|
@ -35,6 +35,10 @@ class TestNetwork(network_fakes.TestNetworkV2):
|
||||
|
||||
# Get a shortcut to the network client
|
||||
self.network = self.app.client_manager.network
|
||||
# Get a shortcut to the ProjectManager Mock
|
||||
self.projects_mock = self.app.client_manager.identity.projects
|
||||
# Get a shortcut to the DomainManager Mock
|
||||
self.domains_mock = self.app.client_manager.identity.domains
|
||||
|
||||
|
||||
class TestCreateNetworkIdentityV3(TestNetwork):
|
||||
@ -89,20 +93,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
|
||||
# Get the command object to test
|
||||
self.cmd = network.CreateNetwork(self.app, self.namespace)
|
||||
|
||||
# Set identity client v3. And get a shortcut to Identity client.
|
||||
identity_client = identity_fakes_v3.FakeIdentityv3Client(
|
||||
endpoint=fakes.AUTH_URL,
|
||||
token=fakes.AUTH_TOKEN,
|
||||
)
|
||||
self.app.client_manager.identity = identity_client
|
||||
self.identity = self.app.client_manager.identity
|
||||
|
||||
# Get a shortcut to the ProjectManager Mock
|
||||
self.projects_mock = self.identity.projects
|
||||
self.projects_mock.get.return_value = self.project
|
||||
|
||||
# Get a shortcut to the DomainManager Mock
|
||||
self.domains_mock = self.identity.domains
|
||||
self.domains_mock.get.return_value = self.domain
|
||||
|
||||
def test_create_no_options(self):
|
||||
|
@ -18,7 +18,6 @@ from osc_lib import exceptions
|
||||
|
||||
from openstackclient.network.v2 import security_group
|
||||
from openstackclient.tests.compute.v2 import fakes as compute_fakes
|
||||
from openstackclient.tests import fakes
|
||||
from openstackclient.tests.identity.v3 import fakes as identity_fakes
|
||||
from openstackclient.tests.network.v2 import fakes as network_fakes
|
||||
from openstackclient.tests import utils as tests_utils
|
||||
@ -31,6 +30,10 @@ class TestSecurityGroupNetwork(network_fakes.TestNetworkV2):
|
||||
|
||||
# Get a shortcut to the network client
|
||||
self.network = self.app.client_manager.network
|
||||
# Get a shortcut to the ProjectManager Mock
|
||||
self.projects_mock = self.app.client_manager.identity.projects
|
||||
# Get a shortcut to the DomainManager Mock
|
||||
self.domains_mock = self.app.client_manager.identity.domains
|
||||
|
||||
|
||||
class TestSecurityGroupCompute(compute_fakes.TestComputev2):
|
||||
@ -72,20 +75,7 @@ class TestCreateSecurityGroupNetwork(TestSecurityGroupNetwork):
|
||||
self.network.create_security_group = mock.Mock(
|
||||
return_value=self._security_group)
|
||||
|
||||
# Set identity client v3. And get a shortcut to Identity client.
|
||||
identity_client = identity_fakes.FakeIdentityv3Client(
|
||||
endpoint=fakes.AUTH_URL,
|
||||
token=fakes.AUTH_TOKEN,
|
||||
)
|
||||
self.app.client_manager.identity = identity_client
|
||||
self.identity = self.app.client_manager.identity
|
||||
|
||||
# Get a shortcut to the ProjectManager Mock
|
||||
self.projects_mock = self.identity.projects
|
||||
self.projects_mock.get.return_value = self.project
|
||||
|
||||
# Get a shortcut to the DomainManager Mock
|
||||
self.domains_mock = self.identity.domains
|
||||
self.domains_mock.get.return_value = self.domain
|
||||
|
||||
# Get the command object to test
|
||||
|
@ -33,6 +33,10 @@ class TestSecurityGroupRuleNetwork(network_fakes.TestNetworkV2):
|
||||
|
||||
# Get a shortcut to the network client
|
||||
self.network = self.app.client_manager.network
|
||||
# Get a shortcut to the ProjectManager Mock
|
||||
self.projects_mock = self.app.client_manager.identity.projects
|
||||
# Get a shortcut to the DomainManager Mock
|
||||
self.domains_mock = self.app.client_manager.identity.domains
|
||||
|
||||
|
||||
class TestSecurityGroupRuleCompute(compute_fakes.TestComputev2):
|
||||
@ -95,20 +99,7 @@ class TestCreateSecurityGroupRuleNetwork(TestSecurityGroupRuleNetwork):
|
||||
self.network.find_security_group = mock.Mock(
|
||||
return_value=self._security_group)
|
||||
|
||||
# Set identity client v3. And get a shortcut to Identity client.
|
||||
identity_client = identity_fakes.FakeIdentityv3Client(
|
||||
endpoint=fakes.AUTH_URL,
|
||||
token=fakes.AUTH_TOKEN,
|
||||
)
|
||||
self.app.client_manager.identity = identity_client
|
||||
self.identity = self.app.client_manager.identity
|
||||
|
||||
# Get a shortcut to the ProjectManager Mock
|
||||
self.projects_mock = self.identity.projects
|
||||
self.projects_mock.get.return_value = self.project
|
||||
|
||||
# Get a shortcut to the DomainManager Mock
|
||||
self.domains_mock = self.identity.domains
|
||||
self.domains_mock.get.return_value = self.domain
|
||||
|
||||
# Get the command object to test
|
||||
|
@ -18,7 +18,6 @@ from osc_lib import exceptions
|
||||
from osc_lib import utils
|
||||
|
||||
from openstackclient.network.v2 import subnet as subnet_v2
|
||||
from openstackclient.tests import fakes
|
||||
from openstackclient.tests.identity.v3 import fakes as identity_fakes_v3
|
||||
from openstackclient.tests.network.v2 import fakes as network_fakes
|
||||
from openstackclient.tests import utils as tests_utils
|
||||
@ -31,6 +30,10 @@ class TestSubnet(network_fakes.TestNetworkV2):
|
||||
|
||||
# Get a shortcut to the network client
|
||||
self.network = self.app.client_manager.network
|
||||
# Get a shortcut to the ProjectManager Mock
|
||||
self.projects_mock = self.app.client_manager.identity.projects
|
||||
# Get a shortcut to the DomainManager Mock
|
||||
self.domains_mock = self.app.client_manager.identity.domains
|
||||
|
||||
|
||||
class TestCreateSubnet(TestSubnet):
|
||||
@ -178,20 +181,7 @@ class TestCreateSubnet(TestSubnet):
|
||||
# Get the command object to test
|
||||
self.cmd = subnet_v2.CreateSubnet(self.app, self.namespace)
|
||||
|
||||
# Set identity client v3. And get a shortcut to Identity client.
|
||||
identity_client = identity_fakes_v3.FakeIdentityv3Client(
|
||||
endpoint=fakes.AUTH_URL,
|
||||
token=fakes.AUTH_TOKEN,
|
||||
)
|
||||
self.app.client_manager.identity = identity_client
|
||||
self.identity = self.app.client_manager.identity
|
||||
|
||||
# Get a shortcut to the ProjectManager Mock
|
||||
self.projects_mock = self.identity.projects
|
||||
self.projects_mock.get.return_value = self.project
|
||||
|
||||
# Get a shortcut to the DomainManager Mock
|
||||
self.domains_mock = self.identity.domains
|
||||
self.domains_mock.get.return_value = self.domain
|
||||
|
||||
# Mock SDK calls for all tests.
|
||||
|
@ -19,7 +19,6 @@ from osc_lib import exceptions
|
||||
from osc_lib import utils
|
||||
|
||||
from openstackclient.network.v2 import subnet_pool
|
||||
from openstackclient.tests import fakes
|
||||
from openstackclient.tests.identity.v3 import fakes as identity_fakes_v3
|
||||
from openstackclient.tests.network.v2 import fakes as network_fakes
|
||||
from openstackclient.tests import utils as tests_utils
|
||||
@ -32,6 +31,10 @@ class TestSubnetPool(network_fakes.TestNetworkV2):
|
||||
|
||||
# Get a shortcut to the network client
|
||||
self.network = self.app.client_manager.network
|
||||
# Get a shortcut to the ProjectManager Mock
|
||||
self.projects_mock = self.app.client_manager.identity.projects
|
||||
# Get a shortcut to the DomainManager Mock
|
||||
self.domains_mock = self.app.client_manager.identity.domains
|
||||
|
||||
|
||||
class TestCreateSubnetPool(TestSubnetPool):
|
||||
@ -84,20 +87,7 @@ class TestCreateSubnetPool(TestSubnetPool):
|
||||
self.network.find_address_scope = mock.Mock(
|
||||
return_value=self._address_scope)
|
||||
|
||||
# Set identity client. And get a shortcut to Identity client.
|
||||
identity_client = identity_fakes_v3.FakeIdentityv3Client(
|
||||
endpoint=fakes.AUTH_URL,
|
||||
token=fakes.AUTH_TOKEN,
|
||||
)
|
||||
self.app.client_manager.identity = identity_client
|
||||
self.identity = self.app.client_manager.identity
|
||||
|
||||
# Get a shortcut to the ProjectManager Mock
|
||||
self.projects_mock = self.identity.projects
|
||||
self.projects_mock.get.return_value = self.project
|
||||
|
||||
# Get a shortcut to the DomainManager Mock
|
||||
self.domains_mock = self.identity.domains
|
||||
self.domains_mock.get.return_value = self.domain
|
||||
|
||||
def test_create_no_options(self):
|
||||
|
Loading…
Reference in New Issue
Block a user