def test_copy_log_machine_logs_speced_per_id(self): """ Create a single log file and set "machine_logs" method to return this file and test that is gets copied as expected """ #first set things up #create a temp dir for logs import tempfile localhost_logs_dir = tempfile.mkdtemp() try: localhost_log_file = os.path.join(localhost_logs_dir, "unittest.log") ztestsuite = SampleTestSuite(Mock_Deployer()) ztestsuite.machine_logs = lambda unique_id: [localhost_log_file] self.__test_copy_log_speced_per_id(ztestsuite, localhost_log_file) finally: shutil.rmtree( localhost_logs_dir)
def test_copy_log_machine_logs_speced_per_id(self): """ Create a single log file and set "machine_logs" method to return this file and test that is gets copied as expected """ #first set things up #create a temp dir for logs import tempfile localhost_logs_dir = tempfile.mkdtemp() try: localhost_log_file = os.path.join(localhost_logs_dir, "unittest.log") ztestsuite = SampleTestSuite(Mock_Deployer()) ztestsuite.machine_logs = lambda unique_id: [localhost_log_file] self.__test_copy_log_speced_per_id(ztestsuite, localhost_log_file, False) finally: shutil.rmtree(localhost_logs_dir)
def test_copy_log_machine_logs_deprecated(self): """ Create a single log file and set "machine_logs" method with DEPRECATED signature to return this file and test that is gets copied as expected """ #first set things up #create a temp dir for logs import tempfile localhost_logs_dir = tempfile.mkdtemp() try: localhost_log_file = os.path.join(localhost_logs_dir, "unittest.log") ztestsuite = SampleTestSuite(Mock_Deployer()) ztestsuite.machine_logs = lambda: { "ztestsuite.unittest": [localhost_log_file] } self.__test_copy_logs_deprecated(ztestsuite, localhost_log_file) finally: shutil.rmtree(localhost_logs_dir)