Skip to content

Commit c75e0a9

Browse files
committed
#1322 add tests for volumen set notes
1 parent 0608306 commit c75e0a9

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed

tests/CLI/modules/block_tests.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def test_volume_detail(self):
6464
self.assertEqual({
6565
'Username': 'username',
6666
'LUN Id': '2',
67+
'Notes': "{'status': 'available'}",
6768
'Endurance Tier': 'READHEAVY_TIER',
6869
'IOPs': 1000,
6970
'Snapshot Capacity (GB)': '10',
@@ -132,6 +133,7 @@ def test_volume_list(self):
132133
'iops': None,
133134
'ip_addr': '10.1.2.3',
134135
'lunId': None,
136+
'notes': "{'status': 'availabl",
135137
'rep_partner_count': None,
136138
'storage_type': 'ENDURANCE',
137139
'username': 'username',
@@ -726,3 +728,21 @@ def test_dep_dupe_convert(self):
726728
result = self.run_command(['block', 'volume-convert', '102'])
727729

728730
self.assert_no_fail(result)
731+
732+
@mock.patch('SoftLayer.BlockStorageManager.volume_set_note')
733+
def test_volume_set_note(self, set_note):
734+
set_note.return_value = True
735+
736+
result = self.run_command(['block', 'volume-set-note', '102', '--note=testing'])
737+
738+
self.assert_no_fail(result)
739+
self.assertIn("successfully!", result.output)
740+
741+
@mock.patch('SoftLayer.BlockStorageManager.volume_set_note')
742+
def test_volume_not_set_note(self, set_note):
743+
set_note.return_value = False
744+
745+
result = self.run_command(['block', 'volume-set-note', '102', '--note=testing'])
746+
747+
self.assert_no_fail(result)
748+
self.assertIn("Note could not be set!", result.output)

tests/CLI/modules/file_tests.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def test_volume_list(self):
5050
'username': 'user',
5151
'active_transactions': None,
5252
'mount_addr': '127.0.0.1:/TEST',
53+
'notes': None,
5354
'rep_partner_count': None
5455
}],
5556
json.loads(result.output))
@@ -137,6 +138,7 @@ def test_volume_detail(self):
137138
'Data Center': 'dal05',
138139
'Type': 'ENDURANCE',
139140
'ID': 100,
141+
'Notes': "{'status': 'available'}",
140142
'# of Active Transactions': '1',
141143
'Ongoing Transaction': 'This is a buffer time in which the customer may cancel the server',
142144
'Replicant Count': '1',
@@ -705,3 +707,21 @@ def test_dep_dupe_convert(self):
705707
result = self.run_command(['file', 'volume-convert', '102'])
706708

707709
self.assert_no_fail(result)
710+
711+
@mock.patch('SoftLayer.FileStorageManager.volume_set_note')
712+
def test_volume_set_note(self, set_note):
713+
set_note.return_value = True
714+
715+
result = self.run_command(['file', 'volume-set-note', '102', '--note=testing'])
716+
717+
self.assert_no_fail(result)
718+
self.assertIn("successfully!", result.output)
719+
720+
@mock.patch('SoftLayer.FileStorageManager.volume_set_note')
721+
def test_volume_not_set_note(self, set_note):
722+
set_note.return_value = False
723+
724+
result = self.run_command(['file', 'volume-set-note', '102', '--note=testing'])
725+
726+
self.assert_no_fail(result)
727+
self.assertIn("Note could not be set!", result.output)

tests/managers/block_tests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ def test_get_block_volume_details(self):
111111
'replicationPartners[id,username,' \
112112
'serviceResourceBackendIpAddress,' \
113113
'serviceResource[datacenter[name]],' \
114-
'replicationSchedule[type[keyname]]]'
114+
'replicationSchedule[type[keyname]]],' \
115+
'notes'
115116

116117
self.assert_called_with(
117118
'SoftLayer_Network_Storage',

tests/managers/file_tests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ def test_get_file_volume_details(self):
145145
'replicationPartners[id,username,'\
146146
'serviceResourceBackendIpAddress,'\
147147
'serviceResource[datacenter[name]],'\
148-
'replicationSchedule[type[keyname]]]'
148+
'replicationSchedule[type[keyname]]],' \
149+
'notes'
149150

150151
self.assert_called_with(
151152
'SoftLayer_Network_Storage',

0 commit comments

Comments
 (0)