Skip to content

Commit b79644f

Browse files
committed
Add integration test for Authorization#remove_scopes
1 parent bf5d103 commit b79644f

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

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", "Accept": "application/vnd.github.v3.full+json", "User-Agent": "github3.py/1.0.0b1", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "Basic <BASIC_AUTH>"}, "method": "GET", "uri": "https://api.github.com/authorizations/10716101"}, "response": {"body": {"string": "", "base64_string": "H4sIAAAAAAAAA32PzWrEMAyEX2XRqYXsxo7z61uPe9vDnlpKUBzRmCaxiRUoXfbd60BLKYTqqPlmNLqB7UFLUclSCpnAuoygYWD2Qacpent6szys3cm4KcWVB7fYT2Tr5pD+uCAB9B70DWacKNqvFPjwBz48PF3OjxH8zY/x9IGTH2nLjpIZLc3cbn1A7AzcE2D3TnPUlTGFJKm6xhRdJosasVeZMTl2dVNRhaZWZU5NjJ0d73f61tr/Ki2ETH2LHG9mQuZHUR+z8ioyXTRaqeftI9/vM0qLSufVxgTjPAXQL7AGWuLCr91oTbuQd/B6/wJ2IBBahQEAAA==", "encoding": "utf-8"}, "headers": {"vary": "Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding", "x-served-by": "6d7de9e645814cac34ea2a8d72ba3141", "x-xss-protection": "1; mode=block", "x-content-type-options": "nosniff", "etag": "\"20b124262b00d14b866e87bfb6c1eead\"", "access-control-allow-credentials": "true", "status": "200 OK", "x-ratelimit-remaining": "4956", "x-github-media-type": "github.v3; param=full; 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", "transfer-encoding": "chunked", "x-github-request-id": "48A0C4D3:0875:29EC956B:53FBFA45", "cache-control": "private, max-age=60, s-maxage=60", "last-modified": "Tue, 26 Aug 2014 03:07:47 GMT", "date": "Tue, 26 Aug 2014 03:08:53 GMT", "access-control-allow-origin": "*", "content-security-policy": "default-src 'none'", "content-encoding": "gzip", "strict-transport-security": "max-age=31536000; includeSubdomains", "server": "GitHub.com", "x-ratelimit-limit": "5000", "x-frame-options": "deny", "content-type": "application/json; charset=utf-8", "x-ratelimit-reset": "1409025614"}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/authorizations/10716101"}, "recorded_at": "2014-08-26T03:08:54"}, {"request": {"body": {"string": "{\"rm_scopes\": [\"user\", \"public_repo\"]}", "encoding": "utf-8"}, "headers": {"Content-Length": "38", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "User-Agent": "github3.py/1.0.0b1", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "Basic <BASIC_AUTH>"}, "method": "POST", "uri": "https://api.github.com/authorizations/10716101"}, "response": {"body": {"string": "", "base64_string": "H4sIAAAAAAAAA32PzWrEMAyEX2XRqYXsxo7z61uPe9vDnlpKUBzRmCaxiRUoXfbd60BLKYTqqPlmNLqB7UFLUclSCpnAuoygYWD2Qacpent6szys3cm4KcWVB7fYT2Tr5pD+uCAB9B70DWacKNqvFPjwBz48PF3OjxH8zY/x9IGTH2nLjpIZLc3cbn1A7AzcE2D3TnPUlTGFJKm6xhRdJosasVeZMTl2dVNRhaZWZU5NjJ0d73f61tr/Ki2ETH2LHG9mQuZHUR+z8ioyXTRaqeftI9/vM0qLSufVxgTjPAXQL7AGWuLCr91oTbuQd/B6/wJ2IBBahQEAAA==", "encoding": "utf-8"}, "headers": {"vary": "Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding", "x-served-by": "c436b2b44345c72ff906059f604991e7", "x-xss-protection": "1; mode=block", "x-content-type-options": "nosniff", "etag": "\"20b124262b00d14b866e87bfb6c1eead\"", "access-control-allow-credentials": "true", "status": "200 OK", "x-ratelimit-remaining": "4955", "x-github-media-type": "github.v3; param=full; 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", "transfer-encoding": "chunked", "x-github-request-id": "48A0C4D3:0875:29EC95B5:53FBFA45", "cache-control": "private, max-age=60, s-maxage=60", "date": "Tue, 26 Aug 2014 03:08:53 GMT", "access-control-allow-origin": "*", "content-security-policy": "default-src 'none'", "content-encoding": "gzip", "strict-transport-security": "max-age=31536000; includeSubdomains", "server": "GitHub.com", "x-ratelimit-limit": "5000", "x-frame-options": "deny", "content-type": "application/json; charset=utf-8", "x-ratelimit-reset": "1409025614"}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/authorizations/10716101"}, "recorded_at": "2014-08-26T03:08:54"}], "recorded_with": "betamax/0.4.0"}

tests/integration/test_auths.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ def test_add_scopes(self):
1717
assert isinstance(auth, github3.auths.Authorization)
1818
assert auth.add_scopes(['user']) is True
1919

20+
def test_remove_scopes(self):
21+
"""Test the ability to remove scopes from an authorization."""
22+
self.basic_login()
23+
cassette_name = self.cassette_name('remove_scopes')
24+
with self.recorder.use_cassette(cassette_name):
25+
auth = self.gh.authorization(10716101)
26+
assert isinstance(auth, github3.auths.Authorization)
27+
assert auth.remove_scopes(['user', 'public_repo']) is True
28+
2029
def test_replace_scopes(self):
2130
"""Test the ability to replace scopes on an authorization."""
2231
self.basic_login()

0 commit comments

Comments
 (0)