From c46f828563116157e636d69fe30ef1c1cabc4503 Mon Sep 17 00:00:00 2001 From: Chenxiong Qi Date: Oct 25 2017 07:07:36 +0000 Subject: Fix mock openidc_client This change allows the test case can be skipped properly when openidc_client is not available within a build environment. Signed-off-by: Chenxiong Qi --- diff --git a/tests/test_cli.py b/tests/test_cli.py index cb9d847..11b9bc8 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1767,7 +1767,7 @@ class TestModulesCli(CliTestCase): } @patch('sys.stdout', new=StringIO()) - @patch.object(openidc_client.OpenIDCClient, 'send_request') + @patch('openidc_client.OpenIDCClient.send_request') def test_module_build(self, mock_oidc_req): """ Test a module build with an SCM URL and branch supplied @@ -1806,7 +1806,7 @@ class TestModulesCli(CliTestCase): self.assertEqual(output, expected_output) @patch('sys.stdout', new=StringIO()) - @patch.object(openidc_client.OpenIDCClient, 'send_request') + @patch('openidc_client.OpenIDCClient.send_request') def test_module_build_input(self, mock_oidc_req): """ Test a module build with default parameters @@ -1834,7 +1834,7 @@ class TestModulesCli(CliTestCase): @patch('sys.stdout', new=StringIO()) @patch('requests.get') - @patch.object(openidc_client.OpenIDCClient, 'send_request') + @patch('openidc_client.OpenIDCClient.send_request') def test_module_cancel(self, mock_oidc_req, mock_get): """ Test canceling a module build when the build exists @@ -1873,7 +1873,7 @@ class TestModulesCli(CliTestCase): self.assertEqual(output, expected_output) @patch('requests.get') - @patch.object(openidc_client.OpenIDCClient, 'send_request') + @patch('openidc_client.OpenIDCClient.send_request') def test_module_cancel_not_found(self, mock_oidc_req, mock_get): """ Test canceling a module build when the build doesn't exist