Skip to content

Commit dad7ce4

Browse files
committed
Solved comments, added validations for test and added unit test for image manager
1 parent 780f274 commit dad7ce4

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

tests/CLI/modules/image_tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,14 @@ def test_datacenter_remove_fails(self):
5757
def test_share(self):
5858
result = self.run_command(['image', 'share', '123456', '--account-id', '654321'])
5959
self.assert_no_fail(result)
60+
self.assertIn("Image template 123456 was shared to account 654321.", result.output)
6061

6162
def test_share_without_id(self):
6263
result = self.run_command(['image', 'share'])
6364
self.assertEqual(2, result.exit_code)
65+
self.assertIn("Error: Missing argument 'IDENTIFIER'.", result.output)
6466

6567
def test_share_without_id_account(self):
6668
result = self.run_command(['image', 'share', "123456"])
6769
self.assertEqual(2, result.exit_code)
70+
self.assertIn("Error: Missing option '--account-id'.", result.output)

tests/managers/image_tests.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,9 @@ def test_get_locations_id_fails(self):
223223
100,
224224
locations
225225
)
226+
227+
def test_share_image(self):
228+
result = self.image.share_image(image_id=123456, account_id=654321)
229+
230+
self.assert_called_with(IMAGE_SERVICE, 'permitSharingAccess', identifier=123456, args=(654321,))
231+
self.assertEqual(True, result)

0 commit comments

Comments
 (0)