Пример #1
0
 def test_get_http_auth_headers(self):
   """Tests that get_http_auth_headers returns the correct result."""
   test_helpers.patch_environ(self)
   os.environ['ACTIONS_RUNTIME_TOKEN'] = 'githubtoken'
   expected_headers = {
       'Authorization': 'Bearer githubtoken',
   }
   self.assertEqual(expected_headers, github_api.get_http_auth_headers())
Пример #2
0
    def setUp(self):
        self.temp_dir_ctx_manager = test_helpers.docker_temp_dir()
        self.workspace = self.temp_dir_ctx_manager.__enter__()
        self.out_dir = os.path.join(self.workspace, 'build-out')
        test_helpers.patch_environ(self)

        base_runner_path = os.path.join(INFRA_DIR, 'base-images',
                                        'base-runner')
        os.environ['PATH'] = os.environ['PATH'] + os.pathsep + base_runner_path
Пример #3
0
    def setUp(self):
        self.temp_dir_obj = tempfile.TemporaryDirectory()
        self.workspace = self.temp_dir_obj.name
        self.out_dir = os.path.join(self.workspace, 'build-out')
        test_helpers.patch_environ(self)

        base_runner_path = os.path.join(INFRA_DIR, 'base-images',
                                        'base-runner')
        os.environ['PATH'] = os.environ['PATH'] + os.pathsep + base_runner_path
Пример #4
0
 def setUp(self):
   test_helpers.patch_environ(self)
   self.token = 'example githubtoken'
   self.owner = 'exampleowner'
   self.repo = 'examplerepo'
   os.environ['GITHUB_REPOSITORY'] = f'{self.owner}/{self.repo}'
   os.environ['GITHUB_EVENT_PATH'] = '/fake'
   self.config = test_helpers.create_run_config(token=self.token)
   self.local_dir = '/local-dir'
   self.testcase = os.path.join(self.local_dir, 'testcase')
Пример #5
0
 def setUp(self):
     self.temp_dir_obj = tempfile.TemporaryDirectory()
     workspace_path = os.path.join(self.temp_dir_obj.name, 'workspace')
     self.config = test_helpers.create_build_config(
         oss_fuzz_project_name=EXAMPLE_PROJECT,
         sanitizer=self.SANITIZER,
         language=self.LANGUAGE,
         workspace=workspace_path,
         pr_ref='refs/pull/1757/merge')
     self.workspace = test_helpers.create_workspace(workspace_path)
     shutil.copytree(TEST_DATA_PATH, workspace_path)
     test_helpers.patch_environ(self, runner=True)
Пример #6
0
 def setUp(self, _):  # pylint: disable=arguments-differ
     test_helpers.patch_environ(self)
     self.owner = 'exampleowner'
     self.repo = 'examplerepo'
     os.environ['GITHUB_REPOSITORY'] = f'{self.owner}/{self.repo}'
     os.environ['GITHUB_EVENT_PATH'] = '/fake'
     os.environ['CFL_PLATFORM'] = 'github'
     os.environ['GITHUB_WORKSPACE'] = '/workspace'
     os.environ['ACTIONS_RUNTIME_TOKEN'] = 'githubtoken'
     self.config = test_helpers.create_run_config()
     self.local_dir = '/local-dir'
     self.testcase = os.path.join(self.local_dir, 'testcase')
Пример #7
0
    def setUp(self):
        """Sets up example fuzz target to test is_reproducible method."""
        self.fuzz_target_name = 'fuzz-target'
        deployment = _create_deployment()
        self.config = deployment.config
        self.workspace = deployment.workspace
        self.fuzz_target_path = os.path.join(self.workspace.out,
                                             self.fuzz_target_name)
        self.testcase_path = '/testcase'
        self.target = fuzz_target.FuzzTarget(self.fuzz_target_path,
                                             fuzz_target.REPRODUCE_ATTEMPTS,
                                             self.workspace, deployment,
                                             deployment.config)

        test_helpers.patch_environ(self, empty=True)
Пример #8
0
    def setUp(self):
        """Sets up example fuzz target to test is_reproducible method."""
        self.fuzz_target_name = 'fuzz-target'
        deployment = _create_deployment()
        self.config = deployment.config
        self.workspace = deployment.workspace
        self.fuzz_target_path = os.path.join(self.workspace.out,
                                             self.fuzz_target_name)
        self.setUpPyfakefs()
        self.fs.create_file(self.fuzz_target_path)
        self.testcase_path = '/testcase'
        self.fs.create_file(self.testcase_path)

        self.target = fuzz_target.FuzzTarget(self.fuzz_target_path,
                                             fuzz_target.REPRODUCE_ATTEMPTS,
                                             self.workspace, deployment,
                                             deployment.config)

        # ClusterFuzz requires ROOT_DIR.
        root_dir = os.environ['ROOT_DIR']
        test_helpers.patch_environ(self, empty=True)
        os.environ['ROOT_DIR'] = root_dir
Пример #9
0
 def setUp(self):
     test_helpers.patch_environ(self)
     self.sanitizer = 'memory'
Пример #10
0
 def setUp(self):
     test_helpers.patch_environ(self)
     self.repo_owner = 'repo-owner'
     self.repo_name = 'repo-name'
     self.github_env = config_utils.GithubEnvironment()
     self.generic_ci_env = config_utils.GenericCiEnvironment()
Пример #11
0
 def setUp(self):
     self.tmp_dir_obj = tempfile.TemporaryDirectory()
     self.workspace = self.tmp_dir_obj.name
     self.out_dir = os.path.join(self.workspace, 'build-out')
     test_helpers.patch_environ(self)
Пример #12
0
 def setUp(self):
     test_helpers.patch_environ(self)
     self.workspace = '/workspace'
     self.project_src_dir_name = 'project-src'
Пример #13
0
 def setUp(self, _):
     test_helpers.patch_environ(self)
     self.repo_owner = 'repo-owner'
     self.repo_name = 'repo-name'
     os.environ['GITHUB_REPOSITORY'] = f'{self.repo_owner}/{self.repo_name}'
     self.platform_conf = platform_config.github.PlatformConfig()
Пример #14
0
 def setUp(self):
     test_helpers.patch_environ(self)
     self.github_token = 'example githubtoken'
Пример #15
0
 def setUp(self):
     test_helpers.patch_environ(self)
     self.env = platform_config.BasePlatformConfig()
Пример #16
0
 def setUp(self):
     test_helpers.patch_environ(self)
     self.repo_owner = 'repo-owner'
     self.repo_name = 'repo-name'
     self.env = platform_config.BasePlatformConfig()
Пример #17
0
 def setUp(self):
     """Patch the environ so that we can execute runner scripts."""
     test_helpers.patch_environ(self, runner=True)
Пример #18
0
 def setUp(self):
     test_helpers.patch_environ(self, runner=True)
Пример #19
0
 def setUp(self, _):
     test_helpers.patch_environ(self)
     self.platform_conf = platform_config.github.PlatformConfig()
Пример #20
0
    def setUp(self):
        test_helpers.patch_environ(self)
        self.workspace = '/workspace'
        os.environ['GITHUB_WORKSPACE'] = self.workspace

        self.project_src_dir_name = 'project-src'
Пример #21
0
 def setUp(self):
     test_helpers.patch_environ(self)
     os.environ['GITHUB_REPOSITORY'] = 'owner/myproject'
 def setUp(self):
   test_helpers.patch_environ(self, empty=True)
Пример #23
0
 def setUp(self):
     test_helpers.patch_environ(self)
Пример #24
0
 def setUp(self):
     test_helpers.patch_environ(self)
     self.repo_owner = 'repo-owner'
     self.repo_name = 'repo-name'