def test_launch_with_specified_log_file(self, mock_tmp): target_func = mock.MagicMock() func = utils.tempest_log_wrapper(target_func) func(self.scenario, log_file='log_file') target_func.assert_called_once_with(self.scenario, log_file="log_file") self.assertEqual(0, mock_tmp.NamedTemporaryFile.call_count)
def test_launch_without_specified_log_file(self, mock_tmp): mock_tmp.NamedTemporaryFile().name = "tmp_file" target_func = mock.MagicMock() func = utils.tempest_log_wrapper(target_func) func(self.scenario) target_func.assert_called_once_with(self.scenario, log_file="/tmp/dir/tmp_file")