Merge "Explicit set capabilities in VolumeDetail and SnapshotDetail"

This commit is contained in:
Zuul 2018-11-01 15:21:13 +00:00 committed by Gerrit Code Review
commit f0b45f3f58
4 changed files with 24 additions and 0 deletions

View File

@ -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.

View File

@ -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.

View File

@ -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)

View File

@ -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)