9edc2ff1d023fe03cf528c7540dbbbfdca0b9b96
[yardstick.git] / yardstick / tests / unit / benchmark / scenarios / lib / test_delete_image.py
1 ##############################################################################
2 # Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
3 #
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9 import unittest
10 import mock
11
12 from yardstick.benchmark.scenarios.lib.delete_image import DeleteImage
13
14
15 class DeleteImageTestCase(unittest.TestCase):
16
17     @mock.patch('yardstick.common.openstack_utils.delete_image')
18     @mock.patch('yardstick.common.openstack_utils.get_image_id')
19     @mock.patch('yardstick.common.openstack_utils.get_glance_client')
20     def test_delete_image(self, mock_get_glance_client, mock_image_id, mock_delete_image):
21         options = {
22             'image_name': 'yardstick_test_image_01'
23         }
24         args = {"options": options}
25         obj = DeleteImage(args, {})
26         obj.run({})
27         self.assertTrue(mock_delete_image.called)
28         self.assertTrue(mock_image_id.called)
29         self.assertTrue(mock_get_glance_client.called)
30
31
32 def main():
33     unittest.main()
34
35
36 if __name__ == '__main__':
37     main()