File: storage_generic_tests.py

package info (click to toggle)
python-softlayer 6.2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,508 kB
  • sloc: python: 57,195; makefile: 133; xml: 97; sh: 59
file content (34 lines) | stat: -rw-r--r-- 1,380 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
    SoftLayer.tests.managers.storage_generic_tests
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    :license: MIT, see LICENSE for more details.
"""

import SoftLayer
from SoftLayer import testing


class StorageGenericTests(testing.TestCase):
    def set_up(self):
        self.storage = SoftLayer.managers.storage.StorageManager(self.client)

    def test_get_volume_snapshot_notification_status(self):
        mock = self.set_mock('SoftLayer_Network_Storage', 'getSnapshotNotificationStatus')
        # These are the values we expect from the API as of 2021-12-01, FBLOCK4193
        mock.side_effect = [None, '1', '0']
        expected = [1, 1, 0]

        for expect in expected:
            result = self.storage.get_volume_snapshot_notification_status(12345)
            self.assert_called_with('SoftLayer_Network_Storage', 'getSnapshotNotificationStatus', identifier=12345)
            self.assertEqual(expect, result)

    def test_set_volume_snapshot_notification(self):
        mock = self.set_mock('SoftLayer_Network_Storage', 'setSnapshotNotification')
        mock.return_value = None

        result = self.storage.set_volume_snapshot_notification(12345, False)
        self.assert_called_with('SoftLayer_Network_Storage', 'setSnapshotNotification',
                                identifier=12345, args=(False,))
        self.assertEqual(None, result)