forked from softlayer/softlayer-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeprecated_tests.py
More file actions
32 lines (23 loc) · 1.01 KB
/
deprecated_tests.py
File metadata and controls
32 lines (23 loc) · 1.01 KB
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
"""
SoftLayer.tests.CLI.deprecated_tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:license: MIT, see LICENSE for more details.
"""
import mock
from SoftLayer.CLI import deprecated
from SoftLayer import testing
from SoftLayer import utils
class EnvironmentTests(testing.TestCase):
def test_main(self):
with mock.patch('sys.stderr', new=utils.StringIO()) as fake_out:
ex = self.assertRaises(SystemExit, deprecated.main)
self.assertEqual(ex.code, -1)
self.assertIn("ERROR: Use the 'slcli' command instead.",
fake_out.getvalue())
def test_with_args(self):
with mock.patch('sys.stderr', new=utils.StringIO()) as fake_out:
with mock.patch('sys.argv', new=['sl', 'module', 'subcommand']):
ex = self.assertRaises(SystemExit, deprecated.main)
self.assertEqual(ex.code, -1)
self.assertIn("ERROR: Use the 'slcli' command instead.",
fake_out.getvalue())