Ejemplo n.º 1
0
 def run_helper(self,
                test_name,
                nettest_args,
                verify_function,
                ooni_args=()):
     output_file = os.path.abspath('test_report.yamloo')
     self.filenames.append(output_file)
     oldargv = sys.argv
     sys.argv = ['']
     sys.argv.extend(ooni_args)
     sys.argv.extend(['-n', '-o', output_file, test_name])
     sys.argv.extend(nettest_args)
     global_options = setupGlobalOptions(False, False, False)
     yield runWithDirector(global_options)
     with open(output_file) as f:
         entries = yaml.safe_load_all(f)
         header = entries.next()
         try:
             first_entry = entries.next()
         except StopIteration:
             raise Exception("Missing entry in report")
     verify_header(header)
     verify_entry(first_entry)
     verify_function(first_entry)
     sys.argv = oldargv
Ejemplo n.º 2
0
 def run_test(self, test_name, args, verify_function):
     output_file = 'test_report.yaml'
     sys.argv = ['', '-n', '-o', output_file, test_name]
     sys.argv.extend(args)
     yield runWithDirector(False, False)
     with open(output_file) as f:
         entries = yaml.safe_load_all(f)
         header = entries.next()
         try:
             first_entry = entries.next()
         except StopIteration:
             raise Exception("Missing entry in report")
     verify_header(header)
     verify_entry(first_entry)
     verify_function(first_entry)
Ejemplo n.º 3
0
 def run_helper(self, test_name, nettest_args, verify_function, ooni_args=()):
     output_file = os.path.abspath('test_report.yamloo')
     self.filenames.append(output_file)
     oldargv = sys.argv
     sys.argv = ['']
     sys.argv.extend(ooni_args)
     sys.argv.extend(['-n', '-o', output_file, test_name])
     sys.argv.extend(nettest_args)
     yield runWithDirector(False, False, False)
     with open(output_file) as f:
         entries = yaml.safe_load_all(f)
         header = entries.next()
         try:
             first_entry = entries.next()
         except StopIteration:
             raise Exception("Missing entry in report")
     verify_header(header)
     verify_entry(first_entry)
     verify_function(first_entry)
     sys.argv = oldargv