blob: 9e47c03c1ea6f7872265f0780b1217fa3a5de384 [file] [log] [blame]
wanghao1850c5f2013-10-08 11:51:29 +08001# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
12
13import uuid
14
15from tempest.api.volume import base
16from tempest.common.utils import data_utils
17from tempest import exceptions
Masayuki Igawa1edf94f2014-03-04 18:34:16 +090018from tempest import test
wanghao1850c5f2013-10-08 11:51:29 +080019
20
Zhi Kun Liubb363a22013-11-28 18:47:39 +080021class VolumesSnapshotNegativeTest(base.BaseVolumeV1Test):
wanghao1850c5f2013-10-08 11:51:29 +080022 _interface = "json"
23
Masayuki Igawa1edf94f2014-03-04 18:34:16 +090024 @test.attr(type=['negative', 'gate'])
wanghao1850c5f2013-10-08 11:51:29 +080025 def test_create_snapshot_with_nonexistent_volume_id(self):
26 # Create a snapshot with nonexistent volume id
27 s_name = data_utils.rand_name('snap')
28 self.assertRaises(exceptions.NotFound,
29 self.snapshots_client.create_snapshot,
30 str(uuid.uuid4()), display_name=s_name)
31
Masayuki Igawa1edf94f2014-03-04 18:34:16 +090032 @test.attr(type=['negative', 'gate'])
wanghao1850c5f2013-10-08 11:51:29 +080033 def test_create_snapshot_without_passing_volume_id(self):
34 # Create a snapshot without passing volume id
35 s_name = data_utils.rand_name('snap')
36 self.assertRaises(exceptions.NotFound,
37 self.snapshots_client.create_snapshot,
38 None, display_name=s_name)
39
40
41class VolumesSnapshotNegativeTestXML(VolumesSnapshotNegativeTest):
42 _interface = "xml"