wanghao | 1850c5f | 2013-10-08 11:51:29 +0800 | [diff] [blame] | 1 | # 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 | |
| 13 | import uuid |
| 14 | |
| 15 | from tempest.api.volume import base |
| 16 | from tempest.common.utils import data_utils |
| 17 | from tempest import exceptions |
Masayuki Igawa | 1edf94f | 2014-03-04 18:34:16 +0900 | [diff] [blame] | 18 | from tempest import test |
wanghao | 1850c5f | 2013-10-08 11:51:29 +0800 | [diff] [blame] | 19 | |
| 20 | |
Zhi Kun Liu | bb363a2 | 2013-11-28 18:47:39 +0800 | [diff] [blame] | 21 | class VolumesSnapshotNegativeTest(base.BaseVolumeV1Test): |
wanghao | 1850c5f | 2013-10-08 11:51:29 +0800 | [diff] [blame] | 22 | _interface = "json" |
| 23 | |
Masayuki Igawa | 1edf94f | 2014-03-04 18:34:16 +0900 | [diff] [blame] | 24 | @test.attr(type=['negative', 'gate']) |
wanghao | 1850c5f | 2013-10-08 11:51:29 +0800 | [diff] [blame] | 25 | 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 Igawa | 1edf94f | 2014-03-04 18:34:16 +0900 | [diff] [blame] | 32 | @test.attr(type=['negative', 'gate']) |
wanghao | 1850c5f | 2013-10-08 11:51:29 +0800 | [diff] [blame] | 33 | 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 | |
| 41 | class VolumesSnapshotNegativeTestXML(VolumesSnapshotNegativeTest): |
| 42 | _interface = "xml" |