Skip to content

Commit 5dc451f

Browse files
fixed failing unit test
1 parent 2c9e150 commit 5dc451f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/CLI/modules/config_tests.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ def set_up(self):
5151
transport = testing.MockableTransport(SoftLayer.FixtureTransport())
5252
self.env.client = SoftLayer.BaseClient(transport=transport)
5353

54+
@mock.patch('SoftLayer.Client')
5455
@mock.patch('SoftLayer.CLI.formatting.confirm')
5556
@mock.patch('SoftLayer.CLI.environment.Environment.getpass')
5657
@mock.patch('SoftLayer.CLI.environment.Environment.input')
57-
def test_setup(self, mocked_input, getpass, confirm_mock):
58+
def test_setup(self, mocked_input, getpass, confirm_mock, client):
59+
client.return_value = self.env.client
5860
if(sys.platform.startswith("win")):
5961
self.skipTest("Test doesn't work in Windows")
6062
with tempfile.NamedTemporaryFile() as config_file:
@@ -67,10 +69,10 @@ def test_setup(self, mocked_input, getpass, confirm_mock):
6769
self.assert_no_fail(result)
6870
self.assertTrue('Configuration Updated Successfully' in result.output)
6971
contents = config_file.read().decode("utf-8")
72+
7073
self.assertTrue('[softlayer]' in contents)
7174
self.assertTrue('username = user' in contents)
72-
self.assertTrue('api_key = AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
73-
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAA' in contents)
75+
self.assertTrue('api_key = AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' in contents)
7476
self.assertTrue('endpoint_url = %s' % consts.API_PUBLIC_ENDPOINT in contents)
7577

7678
@mock.patch('SoftLayer.CLI.formatting.confirm')

0 commit comments

Comments
 (0)