def setUp(self): super(TestCreateSubnet, self).setUp() # 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 = fakes.FakeResource( None, copy.deepcopy(identity_fakes_v3.PROJECT), loaded=True, ) # Get a shortcut to the DomainManager Mock self.domains_mock = self.identity.domains self.domains_mock.get.return_value = fakes.FakeResource( None, copy.deepcopy(identity_fakes_v3.DOMAIN), loaded=True, )
def setUp(self): super(TestCreateSubnet, self).setUp() # Get the command object to test self.cmd = subnet_v2.CreateSubnet(self.app, self.namespace) self.projects_mock.get.return_value = self.project self.domains_mock.get.return_value = self.domain # Mock SDK calls for all tests. self.network.find_network = mock.Mock(return_value=self._network) self.network.find_segment = mock.Mock( return_value=self._network_segment) self.network.find_subnet_pool = mock.Mock( return_value=self._subnet_pool)