Fix coerce good values in test_fields.py

In another patch, working on making Volume Attach Status into an
enum, it was pointed out that the way values were being tested. This
patch goes back and fixes how the other status fields are coercing
good values.

Change-Id: I33c0308ac97a31c3907af3c459eb0cb55e2d7a51
This commit is contained in:
Kendall Nelson 2016-09-13 11:41:28 -05:00
parent dcef62a53d
commit e87ec8d994
1 changed files with 26 additions and 21 deletions

View File

@ -66,13 +66,16 @@ class TestBackupStatus(TestField):
def setUp(self):
super(TestBackupStatus, self).setUp()
self.field = fields.BackupStatusField()
self.coerce_good_values = [('error', 'error'),
('error_deleting', 'error_deleting'),
('creating', 'creating'),
('available', 'available'),
('deleting', 'deleting'),
('deleted', 'deleted'),
('restoring', 'restoring')]
self.coerce_good_values = [('error', fields.BackupStatus.ERROR),
('error_deleting',
fields.BackupStatus.ERROR_DELETING),
('creating', fields.BackupStatus.CREATING),
('available',
fields.BackupStatus.AVAILABLE),
('deleting', fields.BackupStatus.DELETING),
('deleted', fields.BackupStatus.DELETED),
('restoring',
fields.BackupStatus.RESTORING)]
self.coerce_bad_values = ['acme']
self.to_primitive_values = self.coerce_good_values[0:1]
self.from_primitive_values = self.coerce_good_values[0:1]
@ -88,13 +91,14 @@ class TestConsistencyGroupStatus(TestField):
def setUp(self):
super(TestConsistencyGroupStatus, self).setUp()
self.field = fields.ConsistencyGroupStatusField()
self.coerce_good_values = [('error', 'error'),
('available', 'available'),
('creating', 'creating'),
('deleting', 'deleting'),
('deleted', 'deleted'),
('updating', 'updating'),
('error_deleting', 'error_deleting')]
self.coerce_good_values = [
('error', fields.ConsistencyGroupStatus.ERROR),
('available', fields.ConsistencyGroupStatus.AVAILABLE),
('creating', fields.ConsistencyGroupStatus.CREATING),
('deleting', fields.ConsistencyGroupStatus.DELETING),
('deleted', fields.ConsistencyGroupStatus.DELETED),
('updating', fields.ConsistencyGroupStatus.UPDATING),
('error_deleting', fields.ConsistencyGroupStatus.ERROR_DELETING)]
self.coerce_bad_values = ['acme']
self.to_primitive_values = self.coerce_good_values[0:1]
self.from_primitive_values = self.coerce_good_values[0:1]
@ -110,13 +114,14 @@ class TestSnapshotStatus(TestField):
def setUp(self):
super(TestSnapshotStatus, self).setUp()
self.field = fields.SnapshotStatusField()
self.coerce_good_values = [('error', 'error'),
('available', 'available'),
('creating', 'creating'),
('deleting', 'deleting'),
('deleted', 'deleted'),
('updating', 'updating'),
('error_deleting', 'error_deleting')]
self.coerce_good_values = [
('error', fields.SnapshotStatus.ERROR),
('available', fields.SnapshotStatus.AVAILABLE),
('creating', fields.SnapshotStatus.CREATING),
('deleting', fields.SnapshotStatus.DELETING),
('deleted', fields.SnapshotStatus.DELETED),
('updating', fields.SnapshotStatus.UPDATING),
('error_deleting', fields.SnapshotStatus.ERROR_DELETING)]
self.coerce_bad_values = ['acme']
self.to_primitive_values = self.coerce_good_values[0:1]
self.from_primitive_values = self.coerce_good_values[0:1]