From 24251f4b0f1ef4abe10c590af17620eb2ed3576c Mon Sep 17 00:00:00 2001 From: Victor Zeng Date: Tue, 27 Oct 2020 23:53:33 -0500 Subject: [PATCH] Added support for the Self-Hosted actions runners API (#1684) * Added data model for Self-Hosted Actions Runner * Added function for getting self-hosted runners --- github/Repository.py | 46 +++++++++ github/Repository.pyi | 4 + github/SelfHostedActionsRunner.py | 98 +++++++++++++++++++ github/SelfHostedActionsRunner.pyi | 19 ++++ tests/PullRequest1684.py | 68 +++++++++++++ tests/ReplayData/PullRequest1684.setUp.txt | 22 +++++ .../PullRequest1684.testDeleteRunnerId.txt | 33 +++++++ ...PullRequest1684.testDeleteRunnerObject.txt | 55 +++++++++++ .../PullRequest1684.testGetRunners.txt | 22 +++++ .../SelfHostedActionsRunner.setUp.txt | 22 +++++ ...SelfHostedActionsRunner.testAttributes.txt | 11 +++ tests/SelfHostedActionsRunner.py | 45 +++++++++ 12 files changed, 445 insertions(+) create mode 100644 github/SelfHostedActionsRunner.py create mode 100644 github/SelfHostedActionsRunner.pyi create mode 100644 tests/PullRequest1684.py create mode 100644 tests/ReplayData/PullRequest1684.setUp.txt create mode 100644 tests/ReplayData/PullRequest1684.testDeleteRunnerId.txt create mode 100644 tests/ReplayData/PullRequest1684.testDeleteRunnerObject.txt create mode 100644 tests/ReplayData/PullRequest1684.testGetRunners.txt create mode 100644 tests/ReplayData/SelfHostedActionsRunner.setUp.txt create mode 100644 tests/ReplayData/SelfHostedActionsRunner.testAttributes.txt create mode 100644 tests/SelfHostedActionsRunner.py diff --git a/github/Repository.py b/github/Repository.py index a7845b89..d211188f 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -125,6 +125,7 @@ import github.PullRequest import github.Referrer import github.Repository import github.RepositoryKey +import github.SelfHostedActionsRunner import github.SourceImport import github.Stargazer import github.StatsCodeFrequency @@ -2788,6 +2789,33 @@ class Repository(github.GithubObject.CompletableGithubObject): self._requester, headers, data, completed=True ) + def get_self_hosted_runner(self, runner_id): + """ + :calls: `GET /repos/:owner/:repo/actions/runners/:id `_ @@ -3354,6 +3382,24 @@ class Repository(github.GithubObject.CompletableGithubObject): "DELETE", self.url + "/collaborators/" + collaborator ) + def remove_self_hosted_runner(self, runner): + """ + :calls: `DELETE /repos/:owner/:repo/actions/runners/:runner_id `_ + :param runner: int or :class:`github.SelfHostedActionsRunner.SelfHostedActionsRunner` + :rtype: bool + """ + assert isinstance( + runner, github.SelfHostedActionsRunner.SelfHostedActionsRunner + ) or isinstance(runner, int), runner + + if isinstance(runner, github.SelfHostedActionsRunner.SelfHostedActionsRunner): + runner = runner.id + + status, _, _ = self._requester.requestJson( + "DELETE", self.url + "/actions/runners/" + str(runner) + ) + return status == 204 + def subscribe_to_hub(self, event, callback, secret=github.GithubObject.NotSet): """ :calls: `POST /hub `_ diff --git a/github/Repository.pyi b/github/Repository.pyi index 492a6b2b..32947f90 100644 --- a/github/Repository.pyi +++ b/github/Repository.pyi @@ -38,6 +38,7 @@ from github.PullRequest import PullRequest from github.PullRequestComment import PullRequestComment from github.Referrer import Referrer from github.RepositoryKey import RepositoryKey +from github.SelfHostedActionsRunner import SelfHostedActionsRunner from github.SourceImport import SourceImport from github.Stargazer import Stargazer from github.StatsCodeFrequency import StatsCodeFrequency @@ -371,6 +372,8 @@ class Repository(CompletableGithubObject): def get_release(self, id: Union[int, str]) -> GitRelease: ... def get_release_asset(self, id: int) -> GitReleaseAsset: ... def get_releases(self) -> PaginatedList[GitRelease]: ... + def get_self_hosted_runner(self, runner_id: int) -> SelfHostedActionsRunner: ... + def get_self_hosted_runners(self) -> PaginatedList[SelfHostedActionsRunner]: ... def get_source_import(self) -> SourceImport: ... def get_stargazers(self) -> PaginatedList[NamedUser]: ... def get_stargazers_with_dates(self) -> PaginatedList[Stargazer]: ... @@ -478,6 +481,7 @@ class Repository(CompletableGithubObject): def remove_from_collaborators( self, collaborator: Union[str, NamedUser] ) -> None: ... + def remove_self_hosted_runner(self, runner: Union[SelfHostedActionsRunner, int]) -> bool: ... def remove_invitation(self, invite_id: int) -> None: ... def replace_topics(self, topics: List[str]) -> None: ... @property diff --git a/github/SelfHostedActionsRunner.py b/github/SelfHostedActionsRunner.py new file mode 100644 index 00000000..69a140ed --- /dev/null +++ b/github/SelfHostedActionsRunner.py @@ -0,0 +1,98 @@ +# -*- coding: utf-8 -*- + +############################ Copyrights and license ############################ +# # +# Copyright 2020 Victor Zeng # +# # +# This file is part of PyGithub. # +# http://pygithub.readthedocs.io/ # +# # +# PyGithub is free software: you can redistribute it and/or modify it under # +# the terms of the GNU Lesser General Public License as published by the Free # +# Software Foundation, either version 3 of the License, or (at your option) # +# any later version. # +# # +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # +# details. # +# # +# You should have received a copy of the GNU Lesser General Public License # +# along with PyGithub. If not, see . # +# # +################################################################################ + +import github.GithubObject + + +class SelfHostedActionsRunner(github.GithubObject.NonCompletableGithubObject): + """ + This class represents Self-hosted GitHub Actions Runners. The reference can be found at + https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#self-hosted-runners + """ + + def __repr__(self): + return self.get__repr__({"name": self._name.value}) + + @property + def id(self): + """ + :type: int + """ + return self._id.value + + @property + def name(self): + """ + :type: string + """ + return self._name.value + + @property + def os(self): + """ + :type: string + """ + return self._os.value + + @property + def status(self): + """ + :type: str + """ + return self._status.value + + @property + def busy(self): + """ + :type: bool + """ + return self._busy.value + + def labels(self): + """ + :type: list of dicts + """ + return self._labels.value + + def _initAttributes(self): + self._id = github.GithubObject.NotSet + self._name = github.GithubObject.NotSet + self._os = github.GithubObject.NotSet + self._status = github.GithubObject.NotSet + self._busy = github.GithubObject.NotSet + self._labels = [] + + def _useAttributes(self, attributes): + if "id" in attributes: # pragma no branch + self._id = self._makeIntAttribute(attributes["id"]) + if "name" in attributes: # pragma no branch + self._name = self._makeStringAttribute(attributes["name"]) + if "os" in attributes: # pragma no branch + self._os = self._makeStringAttribute(attributes["os"]) + if "status" in attributes: # pragma no branch + self._status = self._makeStringAttribute(attributes["status"]) + if "busy" in attributes: + self._busy = self._makeBoolAttribute(attributes["busy"]) + if "labels" in attributes: + self._labels = self._makeListOfDictsAttribute(attributes["labels"]) diff --git a/github/SelfHostedActionsRunner.pyi b/github/SelfHostedActionsRunner.pyi new file mode 100644 index 00000000..deb486f5 --- /dev/null +++ b/github/SelfHostedActionsRunner.pyi @@ -0,0 +1,19 @@ +from typing import Any, Dict, List, Union + +from github.GithubObject import NonCompletableGithubObject + +class SelfHostedActionsRunner(NonCompletableGithubObject): + def __repr__(self) -> str: ... + def _initAttributes(self) -> None: ... + def _useAttributes(self, attributes: Dict[str, Any]) -> None: ... + @property + def id(self) -> int: ... + @property + def name(self) -> str: ... + @property + def os(self) -> str: ... + @property + def status(self) -> str: ... + @property + def busy(self) -> bool: ... + def labels(self) -> List[Dict[str, Union[str, int]]]: ... diff --git a/tests/PullRequest1684.py b/tests/PullRequest1684.py new file mode 100644 index 00000000..10bbe105 --- /dev/null +++ b/tests/PullRequest1684.py @@ -0,0 +1,68 @@ +############################ Copyrights and license ############################ +# # +# Copyright 2020 Victor Zeng # +# # +# This file is part of PyGithub. # +# http://pygithub.readthedocs.io/ # +# # +# PyGithub is free software: you can redistribute it and/or modify it under # +# the terms of the GNU Lesser General Public License as published by the Free # +# Software Foundation, either version 3 of the License, or (at your option) # +# any later version. # +# # +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # +# details. # +# # +# You should have received a copy of the GNU Lesser General Public License # +# along with PyGithub. If not, see . # +# # +################################################################################ + +from . import Framework + + +class PullRequest1684(Framework.TestCase): + def setUp(self): + super().setUp() + self.user = self.g.get_user("ReDASers") + self.repo = self.user.get_repo("Phishing-Detection") + + def testGetRunners(self): + runners = self.repo.get_self_hosted_runners() + self.assertEqual(19, runners.totalCount) + runner = runners[0] + self.assertEqual(1363, runner.id) + self.assertEqual("windows", runner.os) + self.assertEqual("0D80B14DC506", runner.name) + self.assertEqual("offline", runner.status) + self.assertFalse(runner.busy) + labels = runner.labels() + self.assertEqual(3, len(labels)) + self.assertEqual("self-hosted", labels[0]["name"]) + self.assertEqual("Windows", labels[1]["name"]) + self.assertEqual("X64", labels[2]["name"]) + + def testDeleteRunnerObject(self): + runners = self.repo.get_self_hosted_runners() + initial_length = runners.totalCount + runner_to_delete = runners[0] + + result = self.repo.remove_self_hosted_runner(runner_to_delete) + self.assertTrue(result) + + runners = self.repo.get_self_hosted_runners() + ids = [runner.id for runner in self.repo.get_self_hosted_runners()] + self.assertEqual(initial_length - 1, runners.totalCount) + self.assertNotIn(runner_to_delete.id, ids) + + def testDeleteRunnerId(self): + ids = [runner.id for runner in self.repo.get_self_hosted_runners()] + id_to_delete = ids[0] + + result = self.repo.remove_self_hosted_runner(id_to_delete) + self.assertTrue(result) + + ids = [runner.id for runner in self.repo.get_self_hosted_runners()] + self.assertNotIn(id_to_delete, ids) diff --git a/tests/ReplayData/PullRequest1684.setUp.txt b/tests/ReplayData/PullRequest1684.setUp.txt new file mode 100644 index 00000000..3b3ae747 --- /dev/null +++ b/tests/ReplayData/PullRequest1684.setUp.txt @@ -0,0 +1,22 @@ +https +GET +api.github.com +None +/users/ReDASers +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 07 Sep 2020 22:00:47 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With'), ('ETag', 'W/"e03ba66cb434ea917b2213d2e622f165"'), ('Last-Modified', 'Sun, 23 Aug 2020 16:44:50 GMT'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4923'), ('X-RateLimit-Reset', '1599518262'), ('X-RateLimit-Used', '77'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '1; mode=block'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'C17A:56E7:26E44F:7DEC16:5F56AD8E')] +{"login":"ReDASers","id":67067070,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3MDY3MDcw","avatar_url":"https://avatars0.githubusercontent.com/u/67067070?v=4","gravatar_id":"","url":"https://api.github.com/users/ReDASers","html_url":"https://github.com/ReDASers","followers_url":"https://api.github.com/users/ReDASers/followers","following_url":"https://api.github.com/users/ReDASers/following{/other_user}","gists_url":"https://api.github.com/users/ReDASers/gists{/gist_id}","starred_url":"https://api.github.com/users/ReDASers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReDASers/subscriptions","organizations_url":"https://api.github.com/users/ReDASers/orgs","repos_url":"https://api.github.com/users/ReDASers/repos","events_url":"https://api.github.com/users/ReDASers/events{/privacy}","received_events_url":"https://api.github.com/users/ReDASers/received_events","type":"Organization","site_admin":false,"name":null,"company":null,"blog":"","location":null,"email":null,"hireable":null,"bio":null,"twitter_username":null,"public_repos":1,"public_gists":0,"followers":0,"following":0,"created_at":"2020-06-17T16:24:55Z","updated_at":"2020-08-23T16:44:50Z"} + +https +GET +api.github.com +None +/repos/ReDASers/Phishing-Detection +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 07 Sep 2020 22:00:47 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With'), ('ETag', 'W/"7a5cc4812eca7f648163b812ab640780"'), ('Last-Modified', 'Mon, 07 Sep 2020 20:43:44 GMT'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4922'), ('X-RateLimit-Reset', '1599518262'), ('X-RateLimit-Used', '78'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '1; mode=block'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'C17B:1CD4:39BA46:AA1973:5F56AD8F')] +{"id":146139403,"node_id":"MDEwOlJlcG9zaXRvcnkxNDYxMzk0MDM=","name":"Phishing-Detection","full_name":"ReDASers/Phishing-Detection","private":true,"owner":{"login":"ReDASers","id":67067070,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3MDY3MDcw","avatar_url":"https://avatars0.githubusercontent.com/u/67067070?v=4","gravatar_id":"","url":"https://api.github.com/users/ReDASers","html_url":"https://github.com/ReDASers","followers_url":"https://api.github.com/users/ReDASers/followers","following_url":"https://api.github.com/users/ReDASers/following{/other_user}","gists_url":"https://api.github.com/users/ReDASers/gists{/gist_id}","starred_url":"https://api.github.com/users/ReDASers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReDASers/subscriptions","organizations_url":"https://api.github.com/users/ReDASers/orgs","repos_url":"https://api.github.com/users/ReDASers/repos","events_url":"https://api.github.com/users/ReDASers/events{/privacy}","received_events_url":"https://api.github.com/users/ReDASers/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ReDASers/Phishing-Detection","description":"A customizable benchmarking framework for phishing research. ","fork":false,"url":"https://api.github.com/repos/ReDASers/Phishing-Detection","forks_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/forks","keys_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/teams","hooks_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/hooks","issue_events_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/issues/events{/number}","events_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/events","assignees_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/assignees{/user}","branches_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/branches{/branch}","tags_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/tags","blobs_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/git/refs{/sha}","trees_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/statuses/{sha}","languages_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/languages","stargazers_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/stargazers","contributors_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/contributors","subscribers_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/subscribers","subscription_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/subscription","commits_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/commits{/sha}","git_commits_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/git/commits{/sha}","comments_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/comments{/number}","issue_comment_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/issues/comments{/number}","contents_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/contents/{+path}","compare_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/merges","archive_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/downloads","issues_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/issues{/number}","pulls_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/pulls{/number}","milestones_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/milestones{/number}","notifications_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/labels{/name}","releases_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/releases{/id}","deployments_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/deployments","created_at":"2018-08-26T00:30:13Z","updated_at":"2020-09-07T20:43:44Z","pushed_at":"2020-09-07T20:43:41Z","git_url":"git://github.com/ReDASers/Phishing-Detection.git","ssh_url":"git@github.com:ReDASers/Phishing-Detection.git","clone_url":"https://github.com/ReDASers/Phishing-Detection.git","svn_url":"https://github.com/ReDASers/Phishing-Detection","homepage":"","size":23564,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":10,"license":null,"forks":1,"open_issues":10,"watchers":1,"default_branch":"master","permissions":{"admin":true,"push":true,"pull":true},"temp_clone_token":"ABZLTTB3PDURD2NVIUHG5KC7K2XLW","allow_squash_merge":true,"allow_merge_commit":false,"allow_rebase_merge":true,"delete_branch_on_merge":false,"organization":{"login":"ReDASers","id":67067070,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3MDY3MDcw","avatar_url":"https://avatars0.githubusercontent.com/u/67067070?v=4","gravatar_id":"","url":"https://api.github.com/users/ReDASers","html_url":"https://github.com/ReDASers","followers_url":"https://api.github.com/users/ReDASers/followers","following_url":"https://api.github.com/users/ReDASers/following{/other_user}","gists_url":"https://api.github.com/users/ReDASers/gists{/gist_id}","starred_url":"https://api.github.com/users/ReDASers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReDASers/subscriptions","organizations_url":"https://api.github.com/users/ReDASers/orgs","repos_url":"https://api.github.com/users/ReDASers/repos","events_url":"https://api.github.com/users/ReDASers/events{/privacy}","received_events_url":"https://api.github.com/users/ReDASers/received_events","type":"Organization","site_admin":false},"network_count":1,"subscribers_count":2} + diff --git a/tests/ReplayData/PullRequest1684.testDeleteRunnerId.txt b/tests/ReplayData/PullRequest1684.testDeleteRunnerId.txt new file mode 100644 index 00000000..fefb1bff --- /dev/null +++ b/tests/ReplayData/PullRequest1684.testDeleteRunnerId.txt @@ -0,0 +1,33 @@ +https +GET +api.github.com +None +/repos/ReDASers/Phishing-Detection/actions/runners +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 07 Sep 2020 22:07:53 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With'), ('ETag', 'W/"350cc5b181e4368b7aa3827a5e068520"'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4892'), ('X-RateLimit-Reset', '1599518262'), ('X-RateLimit-Used', '108'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '1; mode=block'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'C347:465E:16E586E:354B93F:5F56AF39')] +{"total_count":19,"runners":[{"id":1363,"name":"0D80B14DC506","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":1798,"name":"9d2952aef5aa","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2217,"name":"4306125c7c84","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2277,"name":"88ADCADD92D4","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2278,"name":"093907886ea1","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2279,"name":"8d76e65a5af4","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2280,"name":"E0104B7E46E6","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2285,"name":"D32B478DA550","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2286,"name":"e57f9c9428a3","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2287,"name":"47f2935f82dc","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2288,"name":"99BCE43F51C7","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2305,"name":"D9DB5B61EA8C","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2306,"name":"3C1625B27C15","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2307,"name":"7df000e59323","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2308,"name":"b0c40e8673fa","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2333,"name":"87F7ACAF675F","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2334,"name":"EAC26A0279E7","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2335,"name":"9937690d9454","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2336,"name":"2a252d515d8f","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]}]} + +https +DELETE +api.github.com +None +/repos/ReDASers/Phishing-Detection/actions/runners/1363 +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +204 +[('Server', 'GitHub.com'), ('Date', 'Mon, 07 Sep 2020 22:07:53 GMT'), ('Status', '204 No Content'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4891'), ('X-RateLimit-Reset', '1599518262'), ('X-RateLimit-Used', '109'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '1; mode=block'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Vary', 'Accept-Encoding, Accept, X-Requested-With'), ('X-GitHub-Request-Id', 'C348:313D:D919B0:202918B:5F56AF39')] + + +https +GET +api.github.com +None +/repos/ReDASers/Phishing-Detection/actions/runners +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 07 Sep 2020 22:07:54 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With'), ('ETag', 'W/"e180057e7da9736b4441f820ae26460d"'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4890'), ('X-RateLimit-Reset', '1599518262'), ('X-RateLimit-Used', '110'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '1; mode=block'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'C349:4AD9:B9E781:1E2DFAF:5F56AF39')] +{"total_count":18,"runners":[{"id":1798,"name":"9d2952aef5aa","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2217,"name":"4306125c7c84","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2277,"name":"88ADCADD92D4","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2278,"name":"093907886ea1","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2279,"name":"8d76e65a5af4","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2280,"name":"E0104B7E46E6","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2285,"name":"D32B478DA550","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2286,"name":"e57f9c9428a3","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2287,"name":"47f2935f82dc","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2288,"name":"99BCE43F51C7","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2305,"name":"D9DB5B61EA8C","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2306,"name":"3C1625B27C15","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2307,"name":"7df000e59323","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2308,"name":"b0c40e8673fa","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2333,"name":"87F7ACAF675F","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2334,"name":"EAC26A0279E7","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2335,"name":"9937690d9454","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2336,"name":"2a252d515d8f","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]}]} + diff --git a/tests/ReplayData/PullRequest1684.testDeleteRunnerObject.txt b/tests/ReplayData/PullRequest1684.testDeleteRunnerObject.txt new file mode 100644 index 00000000..75f67c26 --- /dev/null +++ b/tests/ReplayData/PullRequest1684.testDeleteRunnerObject.txt @@ -0,0 +1,55 @@ +https +GET +api.github.com +None +/repos/ReDASers/Phishing-Detection/actions/runners?per_page=1 +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 07 Sep 2020 22:07:55 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With'), ('ETag', 'W/"944c73b715b546018cb2f5a1f1598543"'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('Link', '; rel="next", ; rel="last"'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4887'), ('X-RateLimit-Reset', '1599518262'), ('X-RateLimit-Used', '113'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '1; mode=block'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'C34C:56EA:183138F:383EFC0:5F56AF3A')] +{"total_count":18,"runners":[{"id":1798,"name":"9d2952aef5aa","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]}]} + +https +GET +api.github.com +None +/repos/ReDASers/Phishing-Detection/actions/runners +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 07 Sep 2020 22:07:55 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With'), ('ETag', 'W/"e180057e7da9736b4441f820ae26460d"'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4886'), ('X-RateLimit-Reset', '1599518262'), ('X-RateLimit-Used', '114'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '1; mode=block'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'C34E:041C:2E3B11C:4DFB2D2:5F56AF3B')] +{"total_count":18,"runners":[{"id":1798,"name":"9d2952aef5aa","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2217,"name":"4306125c7c84","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2277,"name":"88ADCADD92D4","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2278,"name":"093907886ea1","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2279,"name":"8d76e65a5af4","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2280,"name":"E0104B7E46E6","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2285,"name":"D32B478DA550","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2286,"name":"e57f9c9428a3","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2287,"name":"47f2935f82dc","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2288,"name":"99BCE43F51C7","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2305,"name":"D9DB5B61EA8C","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2306,"name":"3C1625B27C15","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2307,"name":"7df000e59323","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2308,"name":"b0c40e8673fa","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2333,"name":"87F7ACAF675F","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2334,"name":"EAC26A0279E7","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2335,"name":"9937690d9454","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2336,"name":"2a252d515d8f","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]}]} + +https +DELETE +api.github.com +None +/repos/ReDASers/Phishing-Detection/actions/runners/1798 +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +204 +[('Server', 'GitHub.com'), ('Date', 'Mon, 07 Sep 2020 22:07:56 GMT'), ('Status', '204 No Content'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4885'), ('X-RateLimit-Reset', '1599518262'), ('X-RateLimit-Used', '115'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '1; mode=block'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Vary', 'Accept-Encoding, Accept, X-Requested-With'), ('X-GitHub-Request-Id', 'C34F:313C:A3419C:167BC1A:5F56AF3B')] + + +https +GET +api.github.com +None +/repos/ReDASers/Phishing-Detection/actions/runners +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 07 Sep 2020 22:07:56 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With'), ('ETag', 'W/"319e363a509450940f067a0664f144b4"'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4884'), ('X-RateLimit-Reset', '1599518262'), ('X-RateLimit-Used', '116'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '1; mode=block'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'C38C:52FF:2A3EFA8:47A5772:5F56AF3C')] +{"total_count":17,"runners":[{"id":2217,"name":"4306125c7c84","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2277,"name":"88ADCADD92D4","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2278,"name":"093907886ea1","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2279,"name":"8d76e65a5af4","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2280,"name":"E0104B7E46E6","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2285,"name":"D32B478DA550","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2286,"name":"e57f9c9428a3","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2287,"name":"47f2935f82dc","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2288,"name":"99BCE43F51C7","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2305,"name":"D9DB5B61EA8C","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2306,"name":"3C1625B27C15","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2307,"name":"7df000e59323","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2308,"name":"b0c40e8673fa","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2333,"name":"87F7ACAF675F","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2334,"name":"EAC26A0279E7","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2335,"name":"9937690d9454","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2336,"name":"2a252d515d8f","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]}]} + +https +GET +api.github.com +None +/repos/ReDASers/Phishing-Detection/actions/runners?per_page=1 +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 07 Sep 2020 22:07:56 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With'), ('ETag', 'W/"e95d50aa8334be2e422c2ffe9614df24"'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('Link', '; rel="next", ; rel="last"'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4883'), ('X-RateLimit-Reset', '1599518262'), ('X-RateLimit-Used', '117'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '1; mode=block'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'C38D:56EB:2F1A367:4E3245A:5F56AF3C')] +{"total_count":17,"runners":[{"id":2217,"name":"4306125c7c84","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]}]} + diff --git a/tests/ReplayData/PullRequest1684.testGetRunners.txt b/tests/ReplayData/PullRequest1684.testGetRunners.txt new file mode 100644 index 00000000..3792bbd2 --- /dev/null +++ b/tests/ReplayData/PullRequest1684.testGetRunners.txt @@ -0,0 +1,22 @@ +https +GET +api.github.com +None +/repos/ReDASers/Phishing-Detection/actions/runners?per_page=1 +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 07 Sep 2020 22:00:47 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With'), ('ETag', 'W/"f719fd52573a6ceae6b407d9acf8e535"'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('Link', '; rel="next", ; rel="last"'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4921'), ('X-RateLimit-Reset', '1599518262'), ('X-RateLimit-Used', '79'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '1; mode=block'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'C17C:0153:2C225EA:4BCDC9A:5F56AD8F')] +{"total_count":19,"runners":[{"id":1363,"name":"0D80B14DC506","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]}]} + +https +GET +api.github.com +None +/repos/ReDASers/Phishing-Detection/actions/runners +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 07 Sep 2020 22:00:48 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With'), ('ETag', 'W/"350cc5b181e4368b7aa3827a5e068520"'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4920'), ('X-RateLimit-Reset', '1599518262'), ('X-RateLimit-Used', '80'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '1; mode=block'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'C17D:5B42:2F23310:4DDF057:5F56AD8F')] +{"total_count":19,"runners":[{"id":1363,"name":"0D80B14DC506","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":1798,"name":"9d2952aef5aa","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2217,"name":"4306125c7c84","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2277,"name":"88ADCADD92D4","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2278,"name":"093907886ea1","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2279,"name":"8d76e65a5af4","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2280,"name":"E0104B7E46E6","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2285,"name":"D32B478DA550","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2286,"name":"e57f9c9428a3","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2287,"name":"47f2935f82dc","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2288,"name":"99BCE43F51C7","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2305,"name":"D9DB5B61EA8C","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2306,"name":"3C1625B27C15","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2307,"name":"7df000e59323","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2308,"name":"b0c40e8673fa","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2333,"name":"87F7ACAF675F","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2334,"name":"EAC26A0279E7","os":"windows","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":2,"name":"Windows","type":"read-only"},{"id":3,"name":"X64","type":"read-only"}]},{"id":2335,"name":"9937690d9454","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]},{"id":2336,"name":"2a252d515d8f","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]}]} + diff --git a/tests/ReplayData/SelfHostedActionsRunner.setUp.txt b/tests/ReplayData/SelfHostedActionsRunner.setUp.txt new file mode 100644 index 00000000..d8e0a326 --- /dev/null +++ b/tests/ReplayData/SelfHostedActionsRunner.setUp.txt @@ -0,0 +1,22 @@ +https +GET +api.github.com +None +/users/ReDASers +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 07 Sep 2020 22:25:54 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With'), ('ETag', 'W/"e03ba66cb434ea917b2213d2e622f165"'), ('Last-Modified', 'Sun, 23 Aug 2020 16:44:50 GMT'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4834'), ('X-RateLimit-Reset', '1599518262'), ('X-RateLimit-Used', '166'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '1; mode=block'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'CB64:1A52:21DA0C9:3A892A5:5F56B372')] +{"login":"ReDASers","id":67067070,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3MDY3MDcw","avatar_url":"https://avatars0.githubusercontent.com/u/67067070?v=4","gravatar_id":"","url":"https://api.github.com/users/ReDASers","html_url":"https://github.com/ReDASers","followers_url":"https://api.github.com/users/ReDASers/followers","following_url":"https://api.github.com/users/ReDASers/following{/other_user}","gists_url":"https://api.github.com/users/ReDASers/gists{/gist_id}","starred_url":"https://api.github.com/users/ReDASers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReDASers/subscriptions","organizations_url":"https://api.github.com/users/ReDASers/orgs","repos_url":"https://api.github.com/users/ReDASers/repos","events_url":"https://api.github.com/users/ReDASers/events{/privacy}","received_events_url":"https://api.github.com/users/ReDASers/received_events","type":"Organization","site_admin":false,"name":null,"company":null,"blog":"","location":null,"email":null,"hireable":null,"bio":null,"twitter_username":null,"public_repos":1,"public_gists":0,"followers":0,"following":0,"created_at":"2020-06-17T16:24:55Z","updated_at":"2020-08-23T16:44:50Z"} + +https +GET +api.github.com +None +/repos/ReDASers/Phishing-Detection +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 07 Sep 2020 22:25:55 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With'), ('ETag', 'W/"802b1aa7dfdc444115a7dcaca43bb1ba"'), ('Last-Modified', 'Mon, 07 Sep 2020 20:43:44 GMT'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4833'), ('X-RateLimit-Reset', '1599518262'), ('X-RateLimit-Used', '167'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '1; mode=block'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'CB65:2B38:20EED81:3B5A74E:5F56B372')] +{"id":146139403,"node_id":"MDEwOlJlcG9zaXRvcnkxNDYxMzk0MDM=","name":"Phishing-Detection","full_name":"ReDASers/Phishing-Detection","private":true,"owner":{"login":"ReDASers","id":67067070,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3MDY3MDcw","avatar_url":"https://avatars0.githubusercontent.com/u/67067070?v=4","gravatar_id":"","url":"https://api.github.com/users/ReDASers","html_url":"https://github.com/ReDASers","followers_url":"https://api.github.com/users/ReDASers/followers","following_url":"https://api.github.com/users/ReDASers/following{/other_user}","gists_url":"https://api.github.com/users/ReDASers/gists{/gist_id}","starred_url":"https://api.github.com/users/ReDASers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReDASers/subscriptions","organizations_url":"https://api.github.com/users/ReDASers/orgs","repos_url":"https://api.github.com/users/ReDASers/repos","events_url":"https://api.github.com/users/ReDASers/events{/privacy}","received_events_url":"https://api.github.com/users/ReDASers/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ReDASers/Phishing-Detection","description":"A customizable benchmarking framework for phishing research. ","fork":false,"url":"https://api.github.com/repos/ReDASers/Phishing-Detection","forks_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/forks","keys_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/teams","hooks_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/hooks","issue_events_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/issues/events{/number}","events_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/events","assignees_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/assignees{/user}","branches_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/branches{/branch}","tags_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/tags","blobs_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/git/refs{/sha}","trees_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/statuses/{sha}","languages_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/languages","stargazers_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/stargazers","contributors_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/contributors","subscribers_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/subscribers","subscription_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/subscription","commits_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/commits{/sha}","git_commits_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/git/commits{/sha}","comments_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/comments{/number}","issue_comment_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/issues/comments{/number}","contents_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/contents/{+path}","compare_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/merges","archive_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/downloads","issues_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/issues{/number}","pulls_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/pulls{/number}","milestones_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/milestones{/number}","notifications_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/labels{/name}","releases_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/releases{/id}","deployments_url":"https://api.github.com/repos/ReDASers/Phishing-Detection/deployments","created_at":"2018-08-26T00:30:13Z","updated_at":"2020-09-07T20:43:44Z","pushed_at":"2020-09-07T20:43:41Z","git_url":"git://github.com/ReDASers/Phishing-Detection.git","ssh_url":"git@github.com:ReDASers/Phishing-Detection.git","clone_url":"https://github.com/ReDASers/Phishing-Detection.git","svn_url":"https://github.com/ReDASers/Phishing-Detection","homepage":"","size":23564,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":10,"license":null,"forks":1,"open_issues":10,"watchers":1,"default_branch":"master","permissions":{"admin":true,"push":true,"pull":true},"temp_clone_token":"ABZLTTFLFBXEARWZCFARAZK7K22J6","allow_squash_merge":true,"allow_merge_commit":false,"allow_rebase_merge":true,"delete_branch_on_merge":false,"organization":{"login":"ReDASers","id":67067070,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3MDY3MDcw","avatar_url":"https://avatars0.githubusercontent.com/u/67067070?v=4","gravatar_id":"","url":"https://api.github.com/users/ReDASers","html_url":"https://github.com/ReDASers","followers_url":"https://api.github.com/users/ReDASers/followers","following_url":"https://api.github.com/users/ReDASers/following{/other_user}","gists_url":"https://api.github.com/users/ReDASers/gists{/gist_id}","starred_url":"https://api.github.com/users/ReDASers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReDASers/subscriptions","organizations_url":"https://api.github.com/users/ReDASers/orgs","repos_url":"https://api.github.com/users/ReDASers/repos","events_url":"https://api.github.com/users/ReDASers/events{/privacy}","received_events_url":"https://api.github.com/users/ReDASers/received_events","type":"Organization","site_admin":false},"network_count":1,"subscribers_count":2} + diff --git a/tests/ReplayData/SelfHostedActionsRunner.testAttributes.txt b/tests/ReplayData/SelfHostedActionsRunner.testAttributes.txt new file mode 100644 index 00000000..8d23eb61 --- /dev/null +++ b/tests/ReplayData/SelfHostedActionsRunner.testAttributes.txt @@ -0,0 +1,11 @@ +https +GET +api.github.com +None +/repos/ReDASers/Phishing-Detection/actions/runners/2217 +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Server', 'GitHub.com'), ('Date', 'Mon, 07 Sep 2020 22:25:55 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Status', '200 OK'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With'), ('ETag', 'W/"e1bb6005140b66d1a4905bfc1af4809c"'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4832'), ('X-RateLimit-Reset', '1599518262'), ('X-RateLimit-Used', '168'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset'), ('Access-Control-Allow-Origin', '*'), ('Strict-Transport-Security', 'max-age=31536000; includeSubdomains; preload'), ('X-Frame-Options', 'deny'), ('X-Content-Type-Options', 'nosniff'), ('X-XSS-Protection', '1; mode=block'), ('Referrer-Policy', 'origin-when-cross-origin, strict-origin-when-cross-origin'), ('Content-Security-Policy', "default-src 'none'"), ('Content-Encoding', 'gzip'), ('X-GitHub-Request-Id', 'CB66:5760:818D4C:15F3BD5:5F56B373')] +{"id":2217,"name":"4306125c7c84","os":"linux","status":"offline","busy":false,"labels":[{"id":1,"name":"self-hosted","type":"read-only"},{"id":3,"name":"X64","type":"read-only"},{"id":4,"name":"Linux","type":"read-only"}]} + diff --git a/tests/SelfHostedActionsRunner.py b/tests/SelfHostedActionsRunner.py new file mode 100644 index 00000000..6264db59 --- /dev/null +++ b/tests/SelfHostedActionsRunner.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- + +############################ Copyrights and license ############################ +# # +# Copyright 2020 Victor Zeng # +# # +# This file is part of PyGithub. # +# http://pygithub.readthedocs.io/ # +# # +# PyGithub is free software: you can redistribute it and/or modify it under # +# the terms of the GNU Lesser General Public License as published by the Free # +# Software Foundation, either version 3 of the License, or (at your option) # +# any later version. # +# # +# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # +# details. # +# # +# You should have received a copy of the GNU Lesser General Public License # +# along with PyGithub. If not, see . # +# # +################################################################################ + +from . import Framework + + +class SelfHostedActionsRunner(Framework.TestCase): + def setUp(self): + super().setUp() + self.user = self.g.get_user("ReDASers") + self.repo = self.user.get_repo("Phishing-Detection") + + def testAttributes(self): + runner = self.repo.get_self_hosted_runner(2217) + self.assertEqual(2217, runner.id) + self.assertEqual("linux", runner.os) + self.assertEqual("4306125c7c84", runner.name) + self.assertEqual("offline", runner.status) + self.assertFalse(runner.busy) + labels = runner.labels() + self.assertEqual(3, len(labels)) + self.assertEqual("self-hosted", labels[0]["name"]) + self.assertEqual("X64", labels[1]["name"]) + self.assertEqual("Linux", labels[2]["name"])