# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from unittest import mock import ddt from manilaclient import api_versions from manilaclient import extension from manilaclient.tests.unit import utils from manilaclient.tests.unit.v2 import fakes from manilaclient.v2 import share_export_locations extensions = [ extension.Extension('share_export_locations', share_export_locations), ] cs = fakes.FakeClient(extensions=extensions) @ddt.ddt class ShareExportLocationsTest(utils.TestCase): def _get_manager(self, microversion): version = api_versions.APIVersion(microversion) mock_microversion = mock.Mock(api_version=version) return (share_export_locations.ShareExportLocationManager( api=mock_microversion)) def test_list_of_export_locations(self): share_id = '1234' cs.share_export_locations.list(share_id, search_opts=None)
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import ddt import mock from manilaclient import api_versions from manilaclient import extension from manilaclient.tests.unit import utils from manilaclient.tests.unit.v2 import fakes from manilaclient.v2 import share_snapshots extensions = [ extension.Extension('share_snapshots', share_snapshots), ] cs = fakes.FakeClient(extensions=extensions) @ddt.ddt class ShareSnapshotsTest(utils.TestCase): def _get_manager(self, microversion): version = api_versions.APIVersion(microversion) mock_microversion = mock.Mock(api_version=version) return share_snapshots.ShareSnapshotManager(api=mock_microversion) def test_create_share_snapshot(self): cs.share_snapshots.create(1234) cs.assert_called('POST', '/snapshots')
# License for the specific language governing permissions and limitations # under the License. from unittest import mock import ddt from manilaclient import api_versions from manilaclient import extension from manilaclient.tests.unit import utils from manilaclient.tests.unit.v2 import fakes from manilaclient.v2 import share_instances extensions = [ extension.Extension('share_instances', share_instances), ] cs = fakes.FakeClient(extensions=extensions) @ddt.ddt class ShareInstancesTest(utils.TestCase): def _get_manager(self, microversion): version = api_versions.APIVersion(microversion) mock_microversion = mock.Mock(api_version=version) return share_instances.ShareInstanceManager(api=mock_microversion) def test_list(self): cs.share_instances.list(search_opts=None) cs.assert_called('GET', '/share_instances')
# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from manilaclient import extension from manilaclient.v1 import shares from tests import utils from tests.v1 import fakes extensions = [ extension.Extension('shares', shares), ] cs = fakes.FakeClient(extensions=extensions) class SharesTest(utils.TestCase): def test_create_nfs_share(self): cs.shares.create('nfs', 1) cs.assert_called('POST', '/shares') def test_create_cifs_share(self): cs.shares.create('cifs', 2) cs.assert_called('POST', '/shares') def test_delete_share(self): share = cs.shares.get('1234')
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import ddt import mock from manilaclient import api_versions from manilaclient import exceptions from manilaclient import extension from manilaclient.tests.unit import utils from manilaclient.tests.unit.v2 import fakes from manilaclient.v2 import share_snapshot_instances extensions = [ extension.Extension('share_snapshot_instances', share_snapshot_instances), ] cs = fakes.FakeClient(extensions=extensions) @ddt.ddt class SnapshotInstancesTest(utils.TestCase): def setUp(self): super(SnapshotInstancesTest, self).setUp() microversion = api_versions.APIVersion("2.19") mock_microversion = mock.Mock(api_version=microversion) self.manager = share_snapshot_instances.ShareSnapshotInstanceManager( api=mock_microversion) @ddt.data(True, False) def test_list(self, detailed):
# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from manilaclient import extension from manilaclient.tests.unit import utils from manilaclient.tests.unit.v2 import fakes from manilaclient.v2 import share_snapshot_instance_export_locations extensions = [ extension.Extension('share_snapshot_export_locations', share_snapshot_instance_export_locations), ] cs = fakes.FakeClient(extensions=extensions) class ShareSnapshotInstanceExportLocationsTest(utils.TestCase): def test_list_snapshot_instance(self): snapshot_instance_id = '1234' cs.share_snapshot_instance_export_locations.list(snapshot_instance_id, search_opts=None) cs.assert_called( 'GET', '/snapshot-instances/%s/export-locations' % snapshot_instance_id) def test_get_snapshot_instance(self): snapshot_instance_id = '1234'