diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2017-05-05 11:23:18 +0200 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2017-05-05 11:24:48 +0200 |
commit | e03be1236ca7e8fd89f9ebc46f01a6ed26463883 (patch) | |
tree | 1d1994e2bd10f7046f74207581cbee69c24078e2 /functest/tests/unit/odl/test_odl.py | |
parent | 695b3013de3a5f80a3a0a55cddbb1d525a6a6b87 (diff) |
Check open args in test_odl
Change-Id: I4b0060502621c7491820b9aa42d8f2f63b06a9ae
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/tests/unit/odl/test_odl.py')
-rw-r--r-- | functest/tests/unit/odl/test_odl.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/functest/tests/unit/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py index 54d6da72..f3d37c65 100644 --- a/functest/tests/unit/odl/test_odl.py +++ b/functest/tests/unit/odl/test_odl.py @@ -337,9 +337,11 @@ class ODLMainTesting(ODLTesting): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ mock.patch.object(odl, 'open', mock.mock_open(), - create=True), \ + create=True) as mock_open, \ mock.patch.object(self.test, 'parse_results'): self._test_main(testcase.TestCase.EX_OK, *args) + mock_open.assert_called_once_with( + os.path.join(odl.ODLTests.res_dir, 'stdout.txt'), 'w+') @mock.patch('os.remove') @mock.patch('robot.run', return_value=1) @@ -348,9 +350,11 @@ class ODLMainTesting(ODLTesting): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ mock.patch.object(odl, 'open', mock.mock_open(), - create=True), \ + create=True) as mock_open, \ mock.patch.object(self.test, 'parse_results'): self._test_main(testcase.TestCase.EX_OK, *args) + mock_open.assert_called_once_with( + os.path.join(odl.ODLTests.res_dir, 'stdout.txt'), 'w+') @mock.patch('os.remove', side_effect=OSError) @mock.patch('robot.run') @@ -359,9 +363,11 @@ class ODLMainTesting(ODLTesting): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ mock.patch.object(odl, 'open', mock.mock_open(), - create=True), \ + create=True) as mock_open, \ mock.patch.object(self.test, 'parse_results'): self._test_main(testcase.TestCase.EX_OK, *args) + mock_open.assert_called_once_with( + os.path.join(odl.ODLTests.res_dir, 'stdout.txt'), 'w+') class ODLRunTesting(ODLTesting): |