diff --git a/github/Consts.py b/github/Consts.py index 93fcd5b5..650264f3 100644 --- a/github/Consts.py +++ b/github/Consts.py @@ -99,3 +99,9 @@ highLightSearchPreview = "application/vnd.github.v3.text-match+json" # https://developer.github.com/changes/2018-02-22-protected-branches-required-signatures/ signaturesProtectedBranchesPreview = "application/vnd.github.zzzax-preview+json" + +# https://developer.github.com/changes/2019-04-24-vulnerability-alerts/ +vulnerabilityAlertsPreview = "application/vnd.github.dorian-preview+json" + +# https://developer.github.com/changes/2019-06-04-automated-security-fixes/ +automatedSecurityFixes = "application/vnd.github.london-preview+json" diff --git a/github/Repository.py b/github/Repository.py index 21f41ecf..2ae5e63e 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -2687,6 +2687,66 @@ class Repository(github.GithubObject.CompletableGithubObject): input=post_parameters ) + def get_vulnerability_alert(self): + """ + :calls: `GET /repos/:owner/:repo/vulnerability-alerts `_ + :rtype: bool + """ + status, _, _ = self._requester.requestJson( + "GET", + self.url + "/vulnerability-alerts", + headers={'Accept': Consts.vulnerabilityAlertsPreview} + ) + return status == 204 + + def enable_vulnerability_alert(self): + """ + :calls: `PUT /repos/:owner/:repo/vulnerability-alerts `_ + :rtype: bool + """ + status, _, _ = self._requester.requestJson( + "PUT", + self.url + "/vulnerability-alerts", + headers={'Accept': Consts.vulnerabilityAlertsPreview} + ) + return status == 204 + + def disable_vulnerability_alert(self): + """ + :calls: `DELETE /repos/:owner/:repo/vulnerability-alerts `_ + :rtype: bool + """ + status, _, _ = self._requester.requestJson( + "DELETE", + self.url + "/vulnerability-alerts", + headers={'Accept': Consts.vulnerabilityAlertsPreview} + ) + return status == 204 + + def enable_automated_security_fixes(self): + """ + :calls: `PUT /repos/:owner/:repo/automated-security-fixes `_ + :rtype: bool + """ + status, _, _ = self._requester.requestJson( + "PUT", + self.url + "/automated-security-fixes", + headers={'Accept': Consts.automatedSecurityFixes} + ) + return status == 204 + + def disable_automated_security_fixes(self): + """ + :calls: `DELETE /repos/:owner/:repo/automated-security-fixes `_ + :rtype: bool + """ + status, _, _ = self._requester.requestJson( + "DELETE", + self.url + "/automated-security-fixes", + headers={'Accept': Consts.automatedSecurityFixes} + ) + return status == 204 + def remove_from_collaborators(self, collaborator): """ :calls: `DELETE /repos/:owner/:repo/collaborators/:user `_ diff --git a/tests/ReplayData/LazyRepository.setUp.txt b/tests/ReplayData/LazyRepository.setUp.txt index ecf3ee81..386cc41a 100644 --- a/tests/ReplayData/LazyRepository.setUp.txt +++ b/tests/ReplayData/LazyRepository.setUp.txt @@ -8,4 +8,3 @@ None 200 [('content-length', '1304'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', 'c6c65e5196703428e7641f7d1e9bc353'), ('x-oauth-scopes', 'gist, repo, user'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', ''), ('etag', '"975c21d2f55751d13745ffc5fa12b1c2"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4960'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '6CE875F7:1E5F:42689E:5514C7D8'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('last-modified', 'Fri, 27 Mar 2015 02:56:43 GMT'), ('date', 'Fri, 27 Mar 2015 03:00:40 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1427427963')] {"login":"korfuri","id":1124263,"avatar_url":"https://avatars.githubusercontent.com/u/1124263?v=3","gravatar_id":"","url":"https://api.github.com/users/korfuri","html_url":"https://github.com/korfuri","followers_url":"https://api.github.com/users/korfuri/followers","following_url":"https://api.github.com/users/korfuri/following{/other_user}","gists_url":"https://api.github.com/users/korfuri/gists{/gist_id}","starred_url":"https://api.github.com/users/korfuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/korfuri/subscriptions","organizations_url":"https://api.github.com/users/korfuri/orgs","repos_url":"https://api.github.com/users/korfuri/repos","events_url":"https://api.github.com/users/korfuri/events{/privacy}","received_events_url":"https://api.github.com/users/korfuri/received_events","type":"User","site_admin":false,"name":"Uriel Corfa","company":"","blog":"http://korfuri.fr/","location":"","email":"uriel@corfa.fr","hireable":false,"bio":null,"public_repos":13,"public_gists":0,"followers":29,"following":57,"created_at":"2011-10-13T02:27:26Z","updated_at":"2015-03-27T02:56:43Z","private_gists":0,"total_private_repos":0,"owned_private_repos":0,"disk_usage":444,"collaborators":0,"plan":{"name":"free","space":976562499,"collaborators":0,"private_repos":0}} - diff --git a/tests/ReplayData/LazyRepository.testChangeAutomateFixWhenNoVulnerabilityAlert.txt b/tests/ReplayData/LazyRepository.testChangeAutomateFixWhenNoVulnerabilityAlert.txt new file mode 100644 index 00000000..2a9ee38c --- /dev/null +++ b/tests/ReplayData/LazyRepository.testChangeAutomateFixWhenNoVulnerabilityAlert.txt @@ -0,0 +1,21 @@ +https +PUT +api.github.com +None +/repos/korfuri/PyGithub/automated-security-fixes +{'Accept': 'application/vnd.github.london-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +422 +[('Date', 'Tue, 06 Aug 2019 11:27:28 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Content-Length', '182'), ('Server', 'GitHub.com'), ('Status', '422 Unprocessable Entity'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4737'), ('X-RateLimit-Reset', '1565093788'), ('X-OAuth-Scopes', 'admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, read:packages, repo, user, write:discussion, write:packages'), ('X-Accepted-OAuth-Scopes', 'repo'), ('X-GitHub-Media-Type', 'github.london-preview; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('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'"), ('X-GitHub-Request-Id', '35EC:6F60:31C510A:3B8AC14:5D49641F')] +{"message":"Vulnerability alerts must be enabled to configure automated security fixes.","documentation_url":"https://developer.github.com/v3/repos/#enable-automated-security-fixes"} + +https +DELETE +api.github.com +None +/repos/korfuri/PyGithub/automated-security-fixes +{'Accept': 'application/vnd.github.london-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +422 +[('Date', 'Tue, 06 Aug 2019 11:27:29 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Content-Length', '183'), ('Server', 'GitHub.com'), ('Status', '422 Unprocessable Entity'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4736'), ('X-RateLimit-Reset', '1565093788'), ('X-OAuth-Scopes', 'admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, read:packages, repo, user, write:discussion, write:packages'), ('X-Accepted-OAuth-Scopes', 'repo'), ('X-GitHub-Media-Type', 'github.london-preview; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('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'"), ('X-GitHub-Request-Id', '1681:54A2:4278804:4F278A2:5D496420')] +{"message":"Vulnerability alerts must be enabled to configure automated security fixes.","documentation_url":"https://developer.github.com/v3/repos/#disable-automated-security-fixes"} diff --git a/tests/ReplayData/LazyRepository.testDisableAutomatedSecurityFixes.txt b/tests/ReplayData/LazyRepository.testDisableAutomatedSecurityFixes.txt new file mode 100644 index 00000000..d6d3f58e --- /dev/null +++ b/tests/ReplayData/LazyRepository.testDisableAutomatedSecurityFixes.txt @@ -0,0 +1,21 @@ +https +DELETE +api.github.com +None +/repos/korfuri/PyGithub/automated-security-fixes +{'Accept': 'application/vnd.github.london-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +204 +[('Date', 'Tue, 06 Aug 2019 11:26:43 GMT'), ('Content-Type', 'application/octet-stream'), ('Server', 'GitHub.com'), ('Status', '204 No Content'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4747'), ('X-RateLimit-Reset', '1565093788'), ('X-OAuth-Scopes', 'admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, read:packages, repo, user, write:discussion, write:packages'), ('X-Accepted-OAuth-Scopes', 'repo'), ('X-GitHub-Media-Type', 'github.london-preview; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('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'), ('X-GitHub-Request-Id', '35D8:4F41:441DF0D:5118793:5D4963F2')] + + +https +DELETE +api.github.com +None +/repos/random/automated-security-fixes +{'Accept': 'application/vnd.github.london-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +404 +[('Date', 'Tue, 06 Aug 2019 11:26:44 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Server', 'GitHub.com'), ('Status', '404 Not Found'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4746'), ('X-RateLimit-Reset', '1565093788'), ('X-OAuth-Scopes', 'admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, read:packages, repo, user, write:discussion, write:packages'), ('X-Accepted-OAuth-Scopes', 'repo'), ('X-GitHub-Media-Type', 'github.london-preview; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('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', '165D:4F41:441DF70:5118805:5D4963F3')] +{"message":"Not Found","documentation_url":"https://developer.github.com/v3/repos/#delete-a-repository"} diff --git a/tests/ReplayData/LazyRepository.testDisableVulnerabilityAlert.txt b/tests/ReplayData/LazyRepository.testDisableVulnerabilityAlert.txt new file mode 100644 index 00000000..866a7de2 --- /dev/null +++ b/tests/ReplayData/LazyRepository.testDisableVulnerabilityAlert.txt @@ -0,0 +1,21 @@ +https +DELETE +api.github.com +None +/repos/korfuri/PyGithub/vulnerability-alerts +{'Accept': 'application/vnd.github.dorian-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +204 +[('Date', 'Tue, 06 Aug 2019 11:27:14 GMT'), ('Content-Type', 'application/octet-stream'), ('Server', 'GitHub.com'), ('Status', '204 No Content'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4740'), ('X-RateLimit-Reset', '1565093788'), ('X-OAuth-Scopes', 'admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, read:packages, repo, user, write:discussion, write:packages'), ('X-Accepted-OAuth-Scopes', 'repo'), ('X-GitHub-Media-Type', 'github.dorian-preview; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('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'), ('X-GitHub-Request-Id', '166D:54A1:2E2788B:379C9F9:5D496411')] + + +https +DELETE +api.github.com +None +/repos/random/vulnerability-alerts +{'Accept': 'application/vnd.github.dorian-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +404 +[('Date', 'Tue, 06 Aug 2019 11:27:15 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Server', 'GitHub.com'), ('Status', '404 Not Found'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4739'), ('X-RateLimit-Reset', '1565093788'), ('X-OAuth-Scopes', 'admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, read:packages, repo, user, write:discussion, write:packages'), ('X-Accepted-OAuth-Scopes', 'repo'), ('X-GitHub-Media-Type', 'github.dorian-preview; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('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', '35E6:4F40:326A400:3C81F6F:5D496412')] +{"message":"Not Found","documentation_url":"https://developer.github.com/v3/repos/#delete-a-repository"} diff --git a/tests/ReplayData/LazyRepository.testEnableAutomatedSecurityFixes.txt b/tests/ReplayData/LazyRepository.testEnableAutomatedSecurityFixes.txt new file mode 100644 index 00000000..2698dd65 --- /dev/null +++ b/tests/ReplayData/LazyRepository.testEnableAutomatedSecurityFixes.txt @@ -0,0 +1,21 @@ +https +PUT +api.github.com +None +/repos/korfuri/PyGithub/automated-security-fixes +{'Accept': 'application/vnd.github.london-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +204 +[('Date', 'Tue, 06 Aug 2019 11:26:29 GMT'), ('Content-Type', 'application/octet-stream'), ('Server', 'GitHub.com'), ('Status', '204 No Content'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4750'), ('X-RateLimit-Reset', '1565093788'), ('X-OAuth-Scopes', 'admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, read:packages, repo, user, write:discussion, write:packages'), ('X-Accepted-OAuth-Scopes', 'repo'), ('X-GitHub-Media-Type', 'github.london-preview; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('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'), ('X-GitHub-Request-Id', '164D:54A1:2E2631B:379B0D8:5D4963E4')] + + +https +PUT +api.github.com +None +/repos/random/automated-security-fixes +{'Accept': 'application/vnd.github.london-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +404 +[('Date', 'Tue, 06 Aug 2019 11:26:30 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Server', 'GitHub.com'), ('Status', '404 Not Found'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4749'), ('X-RateLimit-Reset', '1565093788'), ('X-OAuth-Scopes', 'admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, read:packages, repo, user, write:discussion, write:packages'), ('X-Accepted-OAuth-Scopes', 'repo'), ('X-GitHub-Media-Type', 'github.london-preview; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('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', '35D4:54A2:4276A32:4F254B5:5D4963E5')] +{"message":"Not Found","documentation_url":"https://developer.github.com/v3"} diff --git a/tests/ReplayData/LazyRepository.testEnableVulnerabilityAlert.txt b/tests/ReplayData/LazyRepository.testEnableVulnerabilityAlert.txt new file mode 100644 index 00000000..dd1b8d16 --- /dev/null +++ b/tests/ReplayData/LazyRepository.testEnableVulnerabilityAlert.txt @@ -0,0 +1,21 @@ +https +PUT +api.github.com +None +/repos/korfuri/PyGithub/vulnerability-alerts +{'Accept': 'application/vnd.github.dorian-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +204 +[('Date', 'Tue, 06 Aug 2019 11:26:07 GMT'), ('Content-Type', 'application/octet-stream'), ('Server', 'GitHub.com'), ('Status', '204 No Content'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4753'), ('X-RateLimit-Reset', '1565093788'), ('X-OAuth-Scopes', 'admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, read:packages, repo, user, write:discussion, write:packages'), ('X-Accepted-OAuth-Scopes', 'repo'), ('X-GitHub-Media-Type', 'github.dorian-preview; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('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'), ('X-GitHub-Request-Id', '161D:4F3F:1A2F2B7:1F51B2B:5D4963CE')] + + +https +PUT +api.github.com +None +/repos/random/vulnerability-alerts +{'Accept': 'application/vnd.github.dorian-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +404 +[('Date', 'Tue, 06 Aug 2019 11:26:08 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Server', 'GitHub.com'), ('Status', '404 Not Found'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4752'), ('X-RateLimit-Reset', '1565093788'), ('X-OAuth-Scopes', 'admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, read:packages, repo, user, write:discussion, write:packages'), ('X-Accepted-OAuth-Scopes', 'repo'), ('X-GitHub-Media-Type', 'github.dorian-preview; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('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', '35CE:9CE3:4271E0:504928:5D4963CF')] +{"message":"Not Found","documentation_url":"https://developer.github.com/v3"} diff --git a/tests/ReplayData/LazyRepository.testGetIssues.txt b/tests/ReplayData/LazyRepository.testGetIssues.txt index d73fa84d..d61bca83 100644 --- a/tests/ReplayData/LazyRepository.testGetIssues.txt +++ b/tests/ReplayData/LazyRepository.testGetIssues.txt @@ -30,4 +30,3 @@ None 200 [('content-length', '2'), ('vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('x-served-by', '474556b853193c38f1b14328ce2d1b7d'), ('x-oauth-scopes', 'gist, repo, user'), ('x-xss-protection', '1; mode=block'), ('x-content-type-options', 'nosniff'), ('x-accepted-oauth-scopes', ''), ('etag', '"ce023c8f5eae55b9873e83f4f0d6e9ae"'), ('access-control-allow-credentials', 'true'), ('status', '200 OK'), ('x-ratelimit-remaining', '4961'), ('x-github-media-type', 'github.v3; format=json'), ('access-control-expose-headers', 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval'), ('x-github-request-id', '6CE875F7:1E62:50EDBA:5514C7D7'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Fri, 27 Mar 2015 03:00:39 GMT'), ('access-control-allow-origin', '*'), ('content-security-policy', "default-src 'none'"), ('strict-transport-security', 'max-age=31536000; includeSubdomains; preload'), ('server', 'GitHub.com'), ('x-ratelimit-limit', '5000'), ('x-frame-options', 'deny'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1427427963')] [] - diff --git a/tests/ReplayData/LazyRepository.testGetVulnerabilityAlert.txt b/tests/ReplayData/LazyRepository.testGetVulnerabilityAlert.txt new file mode 100644 index 00000000..9d4e08e4 --- /dev/null +++ b/tests/ReplayData/LazyRepository.testGetVulnerabilityAlert.txt @@ -0,0 +1,32 @@ +https +GET +api.github.com +None +/repos/korfuri/PyGithub +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Date', 'Tue, 06 Aug 2019 11:26:57 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Server', 'GitHub.com'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4744'), ('X-RateLimit-Reset', '1565093788'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('ETag', 'W/"bcd71356b0501183a991a88b20784d03"'), ('Last-Modified', 'Tue, 06 Aug 2019 10:07:25 GMT'), ('X-OAuth-Scopes', 'admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, read:packages, repo, user, write:discussion, write:packages'), ('X-Accepted-OAuth-Scopes', 'repo'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('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', '35DE:9CE7:431A40B:5049896:5D496401')] +{"id":197130728,"node_id":"MDEwOlJlcG9zaXRvcnkxOTcxMzA3Mjg=","name":"PyGithub","full_name":"korfuri/PyGithub","private":false,"owner":{"login":"korfuri","id":29245119,"node_id":"MDQ6VXNlcjI5MjQ1MTE5","avatar_url":"https://avatars3.githubusercontent.com/u/29245119?v=4","gravatar_id":"","url":"https://api.github.com/users/korfuri","html_url":"https://github.com/korfuri","followers_url":"https://api.github.com/users/korfuri/followers","following_url":"https://api.github.com/users/korfuri/following{/other_user}","gists_url":"https://api.github.com/users/korfuri/gists{/gist_id}","starred_url":"https://api.github.com/users/korfuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/korfuri/subscriptions","organizations_url":"https://api.github.com/users/korfuri/orgs","repos_url":"https://api.github.com/users/korfuri/repos","events_url":"https://api.github.com/users/korfuri/events{/privacy}","received_events_url":"https://api.github.com/users/korfuri/received_events","type":"User","site_admin":false},"html_url":"https://github.com/korfuri/PyGithub","description":"Typed interactions with the GitHub API v3","fork":true,"url":"https://api.github.com/repos/korfuri/PyGithub","forks_url":"https://api.github.com/repos/korfuri/PyGithub/forks","keys_url":"https://api.github.com/repos/korfuri/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/korfuri/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/korfuri/PyGithub/teams","hooks_url":"https://api.github.com/repos/korfuri/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/korfuri/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/korfuri/PyGithub/events","assignees_url":"https://api.github.com/repos/korfuri/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/korfuri/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/korfuri/PyGithub/tags","blobs_url":"https://api.github.com/repos/korfuri/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/korfuri/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/korfuri/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/korfuri/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/korfuri/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/korfuri/PyGithub/languages","stargazers_url":"https://api.github.com/repos/korfuri/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/korfuri/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/korfuri/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/korfuri/PyGithub/subscription","commits_url":"https://api.github.com/repos/korfuri/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/korfuri/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/korfuri/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/korfuri/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/korfuri/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/korfuri/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/korfuri/PyGithub/merges","archive_url":"https://api.github.com/repos/korfuri/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/korfuri/PyGithub/downloads","issues_url":"https://api.github.com/repos/korfuri/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/korfuri/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/korfuri/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/korfuri/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/korfuri/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/korfuri/PyGithub/releases{/id}","deployments_url":"https://api.github.com/repos/korfuri/PyGithub/deployments","created_at":"2019-07-16T06:05:51Z","updated_at":"2019-08-06T10:07:25Z","pushed_at":"2019-08-06T10:07:21Z","git_url":"git://github.com/korfuri/PyGithub.git","ssh_url":"git@github.com:korfuri/PyGithub.git","clone_url":"https://github.com/korfuri/PyGithub.git","svn_url":"https://github.com/korfuri/PyGithub","homepage":"https://pygithub.readthedocs.io/","size":11917,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0","node_id":"MDc6TGljZW5zZTEy"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master","permissions":{"admin":true,"push":true,"pull":true},"allow_squash_merge":true,"allow_merge_commit":true,"allow_rebase_merge":true,"parent":{"id":3544490,"node_id":"MDEwOlJlcG9zaXRvcnkzNTQ0NDkw","name":"PyGithub","full_name":"PyGithub/PyGithub","private":false,"owner":{"login":"PyGithub","id":11288996,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMjg4OTk2","avatar_url":"https://avatars0.githubusercontent.com/u/11288996?v=4","gravatar_id":"","url":"https://api.github.com/users/PyGithub","html_url":"https://github.com/PyGithub","followers_url":"https://api.github.com/users/PyGithub/followers","following_url":"https://api.github.com/users/PyGithub/following{/other_user}","gists_url":"https://api.github.com/users/PyGithub/gists{/gist_id}","starred_url":"https://api.github.com/users/PyGithub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PyGithub/subscriptions","organizations_url":"https://api.github.com/users/PyGithub/orgs","repos_url":"https://api.github.com/users/PyGithub/repos","events_url":"https://api.github.com/users/PyGithub/events{/privacy}","received_events_url":"https://api.github.com/users/PyGithub/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/PyGithub/PyGithub","description":"Typed interactions with the GitHub API v3","fork":false,"url":"https://api.github.com/repos/PyGithub/PyGithub","forks_url":"https://api.github.com/repos/PyGithub/PyGithub/forks","keys_url":"https://api.github.com/repos/PyGithub/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PyGithub/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PyGithub/PyGithub/teams","hooks_url":"https://api.github.com/repos/PyGithub/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/PyGithub/PyGithub/events","assignees_url":"https://api.github.com/repos/PyGithub/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/PyGithub/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/PyGithub/PyGithub/tags","blobs_url":"https://api.github.com/repos/PyGithub/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PyGithub/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PyGithub/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/PyGithub/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PyGithub/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/PyGithub/PyGithub/languages","stargazers_url":"https://api.github.com/repos/PyGithub/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/PyGithub/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/PyGithub/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/PyGithub/PyGithub/subscription","commits_url":"https://api.github.com/repos/PyGithub/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/PyGithub/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/PyGithub/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/PyGithub/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/PyGithub/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PyGithub/PyGithub/merges","archive_url":"https://api.github.com/repos/PyGithub/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PyGithub/PyGithub/downloads","issues_url":"https://api.github.com/repos/PyGithub/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/PyGithub/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/PyGithub/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/PyGithub/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PyGithub/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/PyGithub/PyGithub/releases{/id}","deployments_url":"https://api.github.com/repos/PyGithub/PyGithub/deployments","created_at":"2012-02-25T12:53:47Z","updated_at":"2019-08-06T05:16:13Z","pushed_at":"2019-08-06T10:07:24Z","git_url":"git://github.com/PyGithub/PyGithub.git","ssh_url":"git@github.com:PyGithub/PyGithub.git","clone_url":"https://github.com/PyGithub/PyGithub.git","svn_url":"https://github.com/PyGithub/PyGithub","homepage":"https://pygithub.readthedocs.io/","size":11949,"stargazers_count":2735,"watchers_count":2735,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":939,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":68,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0","node_id":"MDc6TGljZW5zZTEy"},"forks":939,"open_issues":68,"watchers":2735,"default_branch":"master"},"source":{"id":3544490,"node_id":"MDEwOlJlcG9zaXRvcnkzNTQ0NDkw","name":"PyGithub","full_name":"PyGithub/PyGithub","private":false,"owner":{"login":"PyGithub","id":11288996,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMjg4OTk2","avatar_url":"https://avatars0.githubusercontent.com/u/11288996?v=4","gravatar_id":"","url":"https://api.github.com/users/PyGithub","html_url":"https://github.com/PyGithub","followers_url":"https://api.github.com/users/PyGithub/followers","following_url":"https://api.github.com/users/PyGithub/following{/other_user}","gists_url":"https://api.github.com/users/PyGithub/gists{/gist_id}","starred_url":"https://api.github.com/users/PyGithub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PyGithub/subscriptions","organizations_url":"https://api.github.com/users/PyGithub/orgs","repos_url":"https://api.github.com/users/PyGithub/repos","events_url":"https://api.github.com/users/PyGithub/events{/privacy}","received_events_url":"https://api.github.com/users/PyGithub/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/PyGithub/PyGithub","description":"Typed interactions with the GitHub API v3","fork":false,"url":"https://api.github.com/repos/PyGithub/PyGithub","forks_url":"https://api.github.com/repos/PyGithub/PyGithub/forks","keys_url":"https://api.github.com/repos/PyGithub/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PyGithub/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PyGithub/PyGithub/teams","hooks_url":"https://api.github.com/repos/PyGithub/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/PyGithub/PyGithub/events","assignees_url":"https://api.github.com/repos/PyGithub/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/PyGithub/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/PyGithub/PyGithub/tags","blobs_url":"https://api.github.com/repos/PyGithub/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PyGithub/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PyGithub/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/PyGithub/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PyGithub/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/PyGithub/PyGithub/languages","stargazers_url":"https://api.github.com/repos/PyGithub/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/PyGithub/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/PyGithub/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/PyGithub/PyGithub/subscription","commits_url":"https://api.github.com/repos/PyGithub/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/PyGithub/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/PyGithub/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/PyGithub/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/PyGithub/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PyGithub/PyGithub/merges","archive_url":"https://api.github.com/repos/PyGithub/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PyGithub/PyGithub/downloads","issues_url":"https://api.github.com/repos/PyGithub/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/PyGithub/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/PyGithub/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/PyGithub/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PyGithub/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/PyGithub/PyGithub/releases{/id}","deployments_url":"https://api.github.com/repos/PyGithub/PyGithub/deployments","created_at":"2012-02-25T12:53:47Z","updated_at":"2019-08-06T05:16:13Z","pushed_at":"2019-08-06T10:07:24Z","git_url":"git://github.com/PyGithub/PyGithub.git","ssh_url":"git@github.com:PyGithub/PyGithub.git","clone_url":"https://github.com/PyGithub/PyGithub.git","svn_url":"https://github.com/PyGithub/PyGithub","homepage":"https://pygithub.readthedocs.io/","size":11949,"stargazers_count":2735,"watchers_count":2735,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":939,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":68,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0","node_id":"MDc6TGljZW5zZTEy"},"forks":939,"open_issues":68,"watchers":2735,"default_branch":"master"},"network_count":939,"subscribers_count":0} + +https +GET +api.github.com +None +/repos/korfuri/PyGithub/vulnerability-alerts +{'Accept': 'application/vnd.github.dorian-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +204 +[('Date', 'Tue, 06 Aug 2019 11:26:58 GMT'), ('Content-Type', 'application/octet-stream'), ('Server', 'GitHub.com'), ('Status', '204 No Content'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4743'), ('X-RateLimit-Reset', '1565093788'), ('X-OAuth-Scopes', 'admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, read:packages, repo, user, write:discussion, write:packages'), ('X-Accepted-OAuth-Scopes', 'repo'), ('X-GitHub-Media-Type', 'github.dorian-preview; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('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'), ('X-GitHub-Request-Id', '35E0:54A2:4277669:4F26387:5D496402')] + + +https +GET +api.github.com +None +/repos/random/vulnerability-alerts +{'Accept': 'application/vnd.github.dorian-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +404 +[('Date', 'Tue, 06 Aug 2019 11:26:59 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Server', 'GitHub.com'), ('Status', '404 Not Found'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4742'), ('X-RateLimit-Reset', '1565093788'), ('X-OAuth-Scopes', 'admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, read:packages, repo, user, write:discussion, write:packages'), ('X-Accepted-OAuth-Scopes', 'repo'), ('X-GitHub-Media-Type', 'github.dorian-preview; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('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', '1665:9CE7:431A509:50499CA:5D496402')] +{"message":"Not Found","documentation_url":"https://developer.github.com/v3/repos/#get"} diff --git a/tests/ReplayData/LazyRepository.testGetVulnerabilityAlertWhenTurnedOff.txt b/tests/ReplayData/LazyRepository.testGetVulnerabilityAlertWhenTurnedOff.txt new file mode 100644 index 00000000..8a265c1f --- /dev/null +++ b/tests/ReplayData/LazyRepository.testGetVulnerabilityAlertWhenTurnedOff.txt @@ -0,0 +1,21 @@ +https +GET +api.github.com +None +/repos/korfuri/PyGithub +{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +200 +[('Date', 'Tue, 06 Aug 2019 11:27:42 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Server', 'GitHub.com'), ('Status', '200 OK'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4734'), ('X-RateLimit-Reset', '1565093788'), ('Cache-Control', 'private, max-age=60, s-maxage=60'), ('Vary', 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding'), ('ETag', 'W/"bcd71356b0501183a991a88b20784d03"'), ('Last-Modified', 'Tue, 06 Aug 2019 10:07:25 GMT'), ('X-OAuth-Scopes', 'admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, read:packages, repo, user, write:discussion, write:packages'), ('X-Accepted-OAuth-Scopes', 'repo'), ('X-GitHub-Media-Type', 'github.v3; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('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', '35F2:4F41:441FFA5:511AEC0:5D49642E')] +{"id":197130728,"node_id":"MDEwOlJlcG9zaXRvcnkxOTcxMzA3Mjg=","name":"PyGithub","full_name":"korfuri/PyGithub","private":false,"owner":{"login":"korfuri","id":29245119,"node_id":"MDQ6VXNlcjI5MjQ1MTE5","avatar_url":"https://avatars3.githubusercontent.com/u/29245119?v=4","gravatar_id":"","url":"https://api.github.com/users/korfuri","html_url":"https://github.com/korfuri","followers_url":"https://api.github.com/users/korfuri/followers","following_url":"https://api.github.com/users/korfuri/following{/other_user}","gists_url":"https://api.github.com/users/korfuri/gists{/gist_id}","starred_url":"https://api.github.com/users/korfuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/korfuri/subscriptions","organizations_url":"https://api.github.com/users/korfuri/orgs","repos_url":"https://api.github.com/users/korfuri/repos","events_url":"https://api.github.com/users/korfuri/events{/privacy}","received_events_url":"https://api.github.com/users/korfuri/received_events","type":"User","site_admin":false},"html_url":"https://github.com/korfuri/PyGithub","description":"Typed interactions with the GitHub API v3","fork":true,"url":"https://api.github.com/repos/korfuri/PyGithub","forks_url":"https://api.github.com/repos/korfuri/PyGithub/forks","keys_url":"https://api.github.com/repos/korfuri/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/korfuri/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/korfuri/PyGithub/teams","hooks_url":"https://api.github.com/repos/korfuri/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/korfuri/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/korfuri/PyGithub/events","assignees_url":"https://api.github.com/repos/korfuri/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/korfuri/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/korfuri/PyGithub/tags","blobs_url":"https://api.github.com/repos/korfuri/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/korfuri/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/korfuri/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/korfuri/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/korfuri/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/korfuri/PyGithub/languages","stargazers_url":"https://api.github.com/repos/korfuri/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/korfuri/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/korfuri/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/korfuri/PyGithub/subscription","commits_url":"https://api.github.com/repos/korfuri/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/korfuri/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/korfuri/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/korfuri/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/korfuri/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/korfuri/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/korfuri/PyGithub/merges","archive_url":"https://api.github.com/repos/korfuri/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/korfuri/PyGithub/downloads","issues_url":"https://api.github.com/repos/korfuri/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/korfuri/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/korfuri/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/korfuri/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/korfuri/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/korfuri/PyGithub/releases{/id}","deployments_url":"https://api.github.com/repos/korfuri/PyGithub/deployments","created_at":"2019-07-16T06:05:51Z","updated_at":"2019-08-06T10:07:25Z","pushed_at":"2019-08-06T10:07:21Z","git_url":"git://github.com/korfuri/PyGithub.git","ssh_url":"git@github.com:korfuri/PyGithub.git","clone_url":"https://github.com/korfuri/PyGithub.git","svn_url":"https://github.com/korfuri/PyGithub","homepage":"https://pygithub.readthedocs.io/","size":11917,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0","node_id":"MDc6TGljZW5zZTEy"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master","permissions":{"admin":true,"push":true,"pull":true},"allow_squash_merge":true,"allow_merge_commit":true,"allow_rebase_merge":true,"parent":{"id":3544490,"node_id":"MDEwOlJlcG9zaXRvcnkzNTQ0NDkw","name":"PyGithub","full_name":"PyGithub/PyGithub","private":false,"owner":{"login":"PyGithub","id":11288996,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMjg4OTk2","avatar_url":"https://avatars0.githubusercontent.com/u/11288996?v=4","gravatar_id":"","url":"https://api.github.com/users/PyGithub","html_url":"https://github.com/PyGithub","followers_url":"https://api.github.com/users/PyGithub/followers","following_url":"https://api.github.com/users/PyGithub/following{/other_user}","gists_url":"https://api.github.com/users/PyGithub/gists{/gist_id}","starred_url":"https://api.github.com/users/PyGithub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PyGithub/subscriptions","organizations_url":"https://api.github.com/users/PyGithub/orgs","repos_url":"https://api.github.com/users/PyGithub/repos","events_url":"https://api.github.com/users/PyGithub/events{/privacy}","received_events_url":"https://api.github.com/users/PyGithub/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/PyGithub/PyGithub","description":"Typed interactions with the GitHub API v3","fork":false,"url":"https://api.github.com/repos/PyGithub/PyGithub","forks_url":"https://api.github.com/repos/PyGithub/PyGithub/forks","keys_url":"https://api.github.com/repos/PyGithub/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PyGithub/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PyGithub/PyGithub/teams","hooks_url":"https://api.github.com/repos/PyGithub/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/PyGithub/PyGithub/events","assignees_url":"https://api.github.com/repos/PyGithub/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/PyGithub/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/PyGithub/PyGithub/tags","blobs_url":"https://api.github.com/repos/PyGithub/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PyGithub/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PyGithub/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/PyGithub/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PyGithub/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/PyGithub/PyGithub/languages","stargazers_url":"https://api.github.com/repos/PyGithub/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/PyGithub/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/PyGithub/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/PyGithub/PyGithub/subscription","commits_url":"https://api.github.com/repos/PyGithub/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/PyGithub/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/PyGithub/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/PyGithub/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/PyGithub/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PyGithub/PyGithub/merges","archive_url":"https://api.github.com/repos/PyGithub/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PyGithub/PyGithub/downloads","issues_url":"https://api.github.com/repos/PyGithub/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/PyGithub/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/PyGithub/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/PyGithub/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PyGithub/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/PyGithub/PyGithub/releases{/id}","deployments_url":"https://api.github.com/repos/PyGithub/PyGithub/deployments","created_at":"2012-02-25T12:53:47Z","updated_at":"2019-08-06T05:16:13Z","pushed_at":"2019-08-06T10:07:24Z","git_url":"git://github.com/PyGithub/PyGithub.git","ssh_url":"git@github.com:PyGithub/PyGithub.git","clone_url":"https://github.com/PyGithub/PyGithub.git","svn_url":"https://github.com/PyGithub/PyGithub","homepage":"https://pygithub.readthedocs.io/","size":11949,"stargazers_count":2735,"watchers_count":2735,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":939,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":68,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0","node_id":"MDc6TGljZW5zZTEy"},"forks":939,"open_issues":68,"watchers":2735,"default_branch":"master"},"source":{"id":3544490,"node_id":"MDEwOlJlcG9zaXRvcnkzNTQ0NDkw","name":"PyGithub","full_name":"PyGithub/PyGithub","private":false,"owner":{"login":"PyGithub","id":11288996,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMjg4OTk2","avatar_url":"https://avatars0.githubusercontent.com/u/11288996?v=4","gravatar_id":"","url":"https://api.github.com/users/PyGithub","html_url":"https://github.com/PyGithub","followers_url":"https://api.github.com/users/PyGithub/followers","following_url":"https://api.github.com/users/PyGithub/following{/other_user}","gists_url":"https://api.github.com/users/PyGithub/gists{/gist_id}","starred_url":"https://api.github.com/users/PyGithub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PyGithub/subscriptions","organizations_url":"https://api.github.com/users/PyGithub/orgs","repos_url":"https://api.github.com/users/PyGithub/repos","events_url":"https://api.github.com/users/PyGithub/events{/privacy}","received_events_url":"https://api.github.com/users/PyGithub/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/PyGithub/PyGithub","description":"Typed interactions with the GitHub API v3","fork":false,"url":"https://api.github.com/repos/PyGithub/PyGithub","forks_url":"https://api.github.com/repos/PyGithub/PyGithub/forks","keys_url":"https://api.github.com/repos/PyGithub/PyGithub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PyGithub/PyGithub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PyGithub/PyGithub/teams","hooks_url":"https://api.github.com/repos/PyGithub/PyGithub/hooks","issue_events_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/events{/number}","events_url":"https://api.github.com/repos/PyGithub/PyGithub/events","assignees_url":"https://api.github.com/repos/PyGithub/PyGithub/assignees{/user}","branches_url":"https://api.github.com/repos/PyGithub/PyGithub/branches{/branch}","tags_url":"https://api.github.com/repos/PyGithub/PyGithub/tags","blobs_url":"https://api.github.com/repos/PyGithub/PyGithub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PyGithub/PyGithub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PyGithub/PyGithub/git/refs{/sha}","trees_url":"https://api.github.com/repos/PyGithub/PyGithub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PyGithub/PyGithub/statuses/{sha}","languages_url":"https://api.github.com/repos/PyGithub/PyGithub/languages","stargazers_url":"https://api.github.com/repos/PyGithub/PyGithub/stargazers","contributors_url":"https://api.github.com/repos/PyGithub/PyGithub/contributors","subscribers_url":"https://api.github.com/repos/PyGithub/PyGithub/subscribers","subscription_url":"https://api.github.com/repos/PyGithub/PyGithub/subscription","commits_url":"https://api.github.com/repos/PyGithub/PyGithub/commits{/sha}","git_commits_url":"https://api.github.com/repos/PyGithub/PyGithub/git/commits{/sha}","comments_url":"https://api.github.com/repos/PyGithub/PyGithub/comments{/number}","issue_comment_url":"https://api.github.com/repos/PyGithub/PyGithub/issues/comments{/number}","contents_url":"https://api.github.com/repos/PyGithub/PyGithub/contents/{+path}","compare_url":"https://api.github.com/repos/PyGithub/PyGithub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PyGithub/PyGithub/merges","archive_url":"https://api.github.com/repos/PyGithub/PyGithub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PyGithub/PyGithub/downloads","issues_url":"https://api.github.com/repos/PyGithub/PyGithub/issues{/number}","pulls_url":"https://api.github.com/repos/PyGithub/PyGithub/pulls{/number}","milestones_url":"https://api.github.com/repos/PyGithub/PyGithub/milestones{/number}","notifications_url":"https://api.github.com/repos/PyGithub/PyGithub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PyGithub/PyGithub/labels{/name}","releases_url":"https://api.github.com/repos/PyGithub/PyGithub/releases{/id}","deployments_url":"https://api.github.com/repos/PyGithub/PyGithub/deployments","created_at":"2012-02-25T12:53:47Z","updated_at":"2019-08-06T05:16:13Z","pushed_at":"2019-08-06T10:07:24Z","git_url":"git://github.com/PyGithub/PyGithub.git","ssh_url":"git@github.com:PyGithub/PyGithub.git","clone_url":"https://github.com/PyGithub/PyGithub.git","svn_url":"https://github.com/PyGithub/PyGithub","homepage":"https://pygithub.readthedocs.io/","size":11949,"stargazers_count":2735,"watchers_count":2735,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":939,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":68,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0","node_id":"MDc6TGljZW5zZTEy"},"forks":939,"open_issues":68,"watchers":2735,"default_branch":"master"},"network_count":939,"subscribers_count":0} + +https +GET +api.github.com +None +/repos/korfuri/PyGithub/vulnerability-alerts +{'Accept': 'application/vnd.github.dorian-preview+json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'} +None +404 +[('Date', 'Tue, 06 Aug 2019 11:27:44 GMT'), ('Content-Type', 'application/json; charset=utf-8'), ('Transfer-Encoding', 'chunked'), ('Server', 'GitHub.com'), ('Status', '404 Not Found'), ('X-RateLimit-Limit', '5000'), ('X-RateLimit-Remaining', '4733'), ('X-RateLimit-Reset', '1565093788'), ('X-OAuth-Scopes', 'admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, read:packages, repo, user, write:discussion, write:packages'), ('X-Accepted-OAuth-Scopes', 'repo'), ('X-GitHub-Media-Type', 'github.dorian-preview; format=json'), ('Access-Control-Expose-Headers', 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type'), ('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', '168D:54A2:4278ED2:4F280D4:5D49642F')] +{"message":"Not Found","documentation_url":"https://developer.github.com/v3/repos/#enable-vulnerability-alerts"} diff --git a/tests/Repository.py b/tests/Repository.py index af77ed64..c0b81c9e 100644 --- a/tests/Repository.py +++ b/tests/Repository.py @@ -693,3 +693,47 @@ class LazyRepository(Framework.TestCase): owner = lazy_repo.owner eager_repo = self.getEagerRepository() self.assertEqual(owner, eager_repo.owner) + + def testEnableVulnerabilityAlert(self): + lazy_repo = self.getLazyRepository() + self.assertTrue(lazy_repo.enable_vulnerability_alert()) + + lazy_repo = self.g.get_repo("random", lazy=True) + self.assertFalse(lazy_repo.enable_vulnerability_alert()) + + def testEnableAutomatedSecurityFixes(self): + lazy_repo = self.getLazyRepository() + self.assertTrue(lazy_repo.enable_automated_security_fixes()) + + lazy_repo = self.g.get_repo("random", lazy=True) + self.assertFalse(lazy_repo.enable_automated_security_fixes()) + + def testDisableAutomatedSecurityFixes(self): + lazy_repo = self.getLazyRepository() + self.assertTrue(lazy_repo.disable_automated_security_fixes()) + + lazy_repo = self.g.get_repo("random", lazy=True) + self.assertFalse(lazy_repo.disable_automated_security_fixes()) + + def testGetVulnerabilityAlert(self): + lazy_repo = self.getEagerRepository() + self.assertTrue(lazy_repo.get_vulnerability_alert()) + + lazy_repo = self.g.get_repo("random", lazy=True) + self.assertFalse(lazy_repo.get_vulnerability_alert()) + + def testDisableVulnerabilityAlert(self): + lazy_repo = self.getLazyRepository() + self.assertTrue(lazy_repo.disable_vulnerability_alert()) + + lazy_repo = self.g.get_repo("random", lazy=True) + self.assertFalse(lazy_repo.disable_vulnerability_alert()) + + def testChangeAutomateFixWhenNoVulnerabilityAlert(self): + lazy_repo = self.getLazyRepository() + self.assertFalse(lazy_repo.enable_automated_security_fixes()) + self.assertFalse(lazy_repo.disable_automated_security_fixes()) + + def testGetVulnerabilityAlertWhenTurnedOff(self): + lazy_repo = self.getEagerRepository() + self.assertFalse(lazy_repo.get_vulnerability_alert())