File: ssl_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 (35 lines) | stat: -rw-r--r-- 1,081 bytes parent folder | download
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
35
"""
    SoftLayer.tests.CLI.modules.ssl_tests
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    :license: MIT, see LICENSE for more details.
"""
from SoftLayer import testing

import json
from unittest import mock as mock


class SslTests(testing.TestCase):
    def test_list(self):
        result = self.run_command(['ssl', 'list', '--status', 'all'])
        self.assert_no_fail(result)
        self.assertEqual(json.loads(result.output), [
            {
                "id": 1234,
                "common_name": "cert",
                "days_until_expire": 0,
                "notes": None
            }
        ])

    @mock.patch('SoftLayer.CLI.formatting.no_going_back')
    def test_remove(self, confirm_mock):
        confirm_mock.return_value = True
        result = self.run_command(['ssl', 'remove', '123456'])
        self.assert_no_fail(result)
        self.assertEqual(result.exit_code, 0)

    def test_download(self):
        result = self.run_command(['ssl', 'download', '123456'])
        self.assert_no_fail(result)
        self.assertEqual(result.exit_code, 0)