Example #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())
Example #2
0
 def test_get_http_auth_headers(self):
   """Tests that get_http_auth_headers returns the correct result."""
   github_token = 'example githubtoken'
   run_config = test_helpers.create_run_config(github_token=github_token)
   expected_headers = {
       'Authorization': f'token {github_token}',
       'Accept': 'application/vnd.github.v3+json',
   }
   self.assertEqual(expected_headers,
                    github_api.get_http_auth_headers(run_config))
Example #3
0
 def __init__(self, config):
     super().__init__(config)
     self.github_api_http_headers = github_api.get_http_auth_headers(config)