Skip to content

Commit 1e70266

Browse files
committed
Require authentication for Repository#pages
- Add test for Repository#pages with cassette
1 parent 0d46b86 commit 1e70266

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

github3/repos/repo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,6 +1657,7 @@ def milestone(self, number):
16571657
json = self._json(self._get(url), 200)
16581658
return Milestone(json, self) if json else None
16591659

1660+
@requires_auth
16601661
def pages(self):
16611662
"""Get information about this repository's pages site.
16621663
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"http_interactions": [{"request": {"body": {"string": "", "encoding": "utf-8"}, "headers": {"Accept-Encoding": "gzip, deflate, compress", "Accept": "application/vnd.github.v3.full+json", "User-Agent": "github3.py/0.8.2", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "Basic <BASIC_AUTH>"}, "method": "GET", "uri": "https://api.github.com/repos/sigmavirus24/github3.py"}, "response": {"body": {"base64_string": "H4sIAAAAAAAAA62Yy5LqNhCGX4XyNgzC3GFzklWS3VmcbLKhZFvGqrEtlyRDMa559/yyfOUkXEbZUGDUn361uuVuVR6PvMNy68+3vj/1cpox7+CduE7KYDkrrt7Ui8s0PTZ/KH7K6JnLUi1WZDRKXHImvUPlpeLEczCGQ0Ex0yxW891yPvXomWoqj6VMMS7RulAHQuxDNbPUUjEZilyzXM9CkZGSWONvQJ1kAzBML/RXu+V6E+328X6xZpv9wt/uAsb8aL+kYbyFwc1EBW8msWTMpMiN2kRn6Y0+q6s2uRkcizQVF1BuV/RoItJZGjfXFJ6fvkiBZUWEThgciyV9GkdxpV8XVVtV2F2ljzwyHIXdkix6WVhjB1kmOD4rIlkhamAZqFDyQnORvy5wZA2akCea8w/6NRqsFSBG2utSaitYszMC9XVza1aRQvIzDa/GNZKFjJ/h7C8ib+xB1NfC5PRfCArjeq7ZkUaZydGYpop9Tr16eo1B9YMpUvLZ6B+fARHrdhUTfr/qROS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ub-OTP, Accept-Encoding", "x-github-media-type": "github.v3; param=full; format=json", "x-xss-protection": "1; mode=block", "x-content-type-options": "nosniff", "etag": "\"e478f02b94af0bade6f085d1efd9ab6a\"", "cache-control": "private, max-age=60, s-maxage=60", "status": "200 OK", "x-ratelimit-remaining": "4974", "x-served-by": "a1d8c69b807c8e21f06cad9da377d1b0", "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", "transfer-encoding": "chunked", "x-github-request-id": "48A0C9F6:2126:C2770:534E6D4C", "access-control-allow-credentials": "true", "last-modified": "Wed, 16 Apr 2014 02:19:49 GMT", "date": "Wed, 16 Apr 2014 11:45:17 GMT", "access-control-allow-origin": "*", "content-security-policy": "default-src 'none'", "content-encoding": "gzip", "strict-transport-security": "max-age=31536000", "server": "GitHub.com", "x-ratelimit-limit": "5000", "x-frame-options": "deny", "content-type": "application/json; charset=utf-8", "x-ratelimit-reset": "1397651155"}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/sigmavirus24/github3.py"}, "recorded_at": "2014-04-16T11:45:17"}, {"request": {"body": {"string": "", "encoding": "utf-8"}, "headers": {"Accept-Encoding": "gzip, deflate, compress", "Accept": "application/vnd.github.v3.full+json", "User-Agent": "github3.py/0.8.2", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "Basic <BASIC_AUTH>"}, "method": "GET", "uri": "https://api.github.com/repos/sigmavirus24/github3.py/pages"}, "response": {"body": {"base64_string": "H4sIAAAAAAAAAyWMQQoCMQwA/5KzNKI99TOSXWo3kG5Dkwgi/t2Cx5mB+UBMgQKHu1pBJOXU2I/Y0j46zqrD0Lh1evEMu2X813vSNyq1anABc/KwddmCxZfYT+oVyhkiC8J89Ee+ZihPEqvfH2LRabJ1AAAA", "encoding": "utf-8"}, "headers": {"vary": "Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding", "x-github-media-type": "github.v3; param=full; format=json", "x-xss-protection": "1; mode=block", "x-content-type-options": "nosniff", "etag": "\"e478f02b94af0bade6f085d1efd9ab6a\"", "cache-control": "private, max-age=60, s-maxage=60", "status": "200 OK", "x-ratelimit-remaining": "4973", "x-served-by": "c436b2b44345c72ff906059f604991e7", "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", "transfer-encoding": "chunked", "x-github-request-id": "48A0C9F6:2126:C27AC:534E6D4D", "access-control-allow-credentials": "true", "last-modified": "Wed, 16 Apr 2014 02:19:49 GMT", "date": "Wed, 16 Apr 2014 11:45:17 GMT", "access-control-allow-origin": "*", "content-security-policy": "default-src 'none'", "content-encoding": "gzip", "strict-transport-security": "max-age=31536000", "server": "GitHub.com", "x-ratelimit-limit": "5000", "x-frame-options": "deny", "content-type": "application/json; charset=utf-8", "x-ratelimit-reset": "1397651155"}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/sigmavirus24/github3.py/pages"}, "recorded_at": "2014-04-16T11:45:17"}], "recorded_with": "betamax/{version}"}

tests/integration/test_repos_pages.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@
44

55

66
class TestRepositoryPages(IntegrationHelper):
7+
def test_pages(self):
8+
"""
9+
Test the ability to retrieve information about a repository's pages.
10+
"""
11+
self.basic_login()
12+
cassette_name = self.cassette_name('pages')
13+
with self.recorder.use_cassette(cassette_name):
14+
repository = self.gh.repository('sigmavirus24', 'github3.py')
15+
assert repository is not None
16+
pages_info = repository.pages()
17+
18+
assert isinstance(pages_info, github3.repos.pages.PagesInfo)
19+
720
def test_iter_pages_builds(self):
821
"""Test the ability to list the pages builds."""
922
self.basic_login()

0 commit comments

Comments
 (0)