Explicit set capabilities in VolumeDetail and SnapshotDetail
VolumeDetail and SnapshotDetail classes inherit the capability attributes of their parent classes, ie Volume and Snapshot, but their `base_path` only supports listing instances, unlike their parent classes, so explicitly set all capability attributes to `False` except for `allow_list`. Story: 2004226 Task: 27746 Change-Id: I001f19093bcf6e5eb18c15d7e1dab8c0f723e04b
This commit is contained in:
parent
a8ac6cc219
commit
dbaf360a37
|
@ -57,6 +57,13 @@ class SnapshotDetail(Snapshot):
|
|||
|
||||
base_path = "/snapshots/detail"
|
||||
|
||||
# capabilities
|
||||
allow_fetch = False
|
||||
allow_create = False
|
||||
allow_delete = False
|
||||
allow_commit = False
|
||||
allow_list = True
|
||||
|
||||
#: The percentage of completeness the snapshot is currently at.
|
||||
progress = resource.Body("os-extended-snapshot-attributes:progress")
|
||||
#: The project ID this snapshot is associated with.
|
||||
|
|
|
@ -94,6 +94,13 @@ class VolumeDetail(Volume):
|
|||
|
||||
base_path = "/volumes/detail"
|
||||
|
||||
# capabilities
|
||||
allow_fetch = False
|
||||
allow_create = False
|
||||
allow_delete = False
|
||||
allow_commit = False
|
||||
allow_list = True
|
||||
|
||||
#: The volume's current back-end.
|
||||
host = resource.Body("os-vol-host-attr:host")
|
||||
#: The project ID associated with current back-end.
|
||||
|
|
|
@ -77,6 +77,11 @@ class TestSnapshotDetail(base.TestCase):
|
|||
sot = snapshot.SnapshotDetail(DETAILED_SNAPSHOT)
|
||||
self.assertIsInstance(sot, snapshot.Snapshot)
|
||||
self.assertEqual("/snapshots/detail", sot.base_path)
|
||||
self.assertFalse(sot.allow_fetch)
|
||||
self.assertFalse(sot.allow_commit)
|
||||
self.assertFalse(sot.allow_create)
|
||||
self.assertFalse(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
|
||||
def test_create_detailed(self):
|
||||
sot = snapshot.SnapshotDetail(**DETAILED_SNAPSHOT)
|
||||
|
|
|
@ -126,6 +126,11 @@ class TestVolumeDetail(base.TestCase):
|
|||
sot = volume.VolumeDetail(VOLUME_DETAIL)
|
||||
self.assertIsInstance(sot, volume.Volume)
|
||||
self.assertEqual("/volumes/detail", sot.base_path)
|
||||
self.assertFalse(sot.allow_fetch)
|
||||
self.assertFalse(sot.allow_commit)
|
||||
self.assertFalse(sot.allow_create)
|
||||
self.assertFalse(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
|
||||
def test_create(self):
|
||||
sot = volume.VolumeDetail(**VOLUME_DETAIL)
|
||||
|
|
Loading…
Reference in New Issue