8000 Add integration test for archiving a repository · pythonthings/github3.py@3af6035 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3af6035

Browse files
committed
Add integration test for archiving a repository
1 parent f896a8a commit 3af6035

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"http_interactions": [{"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": "github3.py/1.0.0a4", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "Connection": "keep-alive", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>"}, "method": "GET", "uri": "https://api.github.com/orgs/testgh3py"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA51Ty26rMBD9F6/bAnm1Qar6Cd10dTfWABNwa2zLHqfKjfLvd8BE5TaLiu7w2GdmzoOz0LZVRpSCMFDbrd1J3AnViHK9zddPj0V+J6LXfN8RuVBmGTj10CrqYvVQ2z6zvg3ZHOvR2SAXYLIRwVPxiIaWQROEsZ21H8ugI2LgGkLEZdAEYWyPfYV+GXjCnLP0ceE2LlZa1fI33f6HzpvCEQj8dyPGYigmB2NAX1tDrPtoZsyurr8cnze8WYOh9sqRshwRE7VmpSFINh2M+gtDXTpv37GmIEryEdOD0VJF1p9urqeNk+klx2sqtCoMPbhwsFrbT9Z1dlKmHU8d9fobp1kY5zmsPQJhI4E4vKu8eLrPi/t89Vbsym1RFvkfphdd8+MbOjnkDq8zyowkS6CZm2JBUX6RsZ+GZ97Wr5WJZZKyUeFDxgAtD0iVmqlDZT2wdEw/FSulNfOX2IPiPzEVnQa25CwM9MN6B4/IawUHNR/3j7vtbrXZ71ndmxUP3I53DCwPj9gwKH3ll8HvA0RNidDkH/qeAz9LwDWnNRiZVP56r3DKweUfztWkQFoEAAA=", "string": ""}, "headers": {"Server": "GitHub.com", "Date": "Sun, 07 Jan 2018 12:31:46 GMT", "Content-Type": "application/json; charset=utf-8", "Transfer-Encoding": "chunked", "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4999", "X-RateLimit-Reset": "1515331906", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "ETag": "W/\"07e6728d35aac30ffd7d5bf4929273b2\"", "Last-Modified": "Tue, 02 Jan 2018 16:51:10 GMT", "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user", "X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Access-Control-Expose-Headers": "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Access-Control-Allow-Origin": "*", "Content-Security-Policy": "default-src 'none'", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "X-Runtime-rack": "0.043049", "Content-Encoding": "gzip", "X-GitHub-Request-Id": "BC06:2D7EB:F7DD33:1EDD35F:5A521331"}, "status": {"code": 200, "message": "OK"}, "url": "https://api.github.com/orgs/testgh3py"}, "recorded_at": "2018-01-07T12:31:46"}, {"request": {"body": {"encoding": "utf-8", "string": "{\"name\": \"archive-me\", \"description\": \"\", \"homepage\": \"\", \"private\": false, \"has_issues\": true, \"has_wiki\": true, \"license_template\": \"\", \"auto_init\": false, \"gitignore_template\": \"\"}"}, "headers": {"User-Agent": "github3.py/1.0.0a4", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "Connection": "keep-alive", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>", "Content-Length": "183"}, "method": "POST", "uri": "https://api.github.com/orgs/testgh3py/repos"}, "response": {"body": {"encoding": "utf-8", "string": "{\"id\":116563839,\"name\":\"archive-me\",\"full_name\":\"testgh3py/archive-me\",\"owner\":{\"login\":\"testgh3py\",\"id\":35038710,\"avatar_url\":\"https://avatars1.githubusercontent.com/u/35038710?v=4\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/testgh3py\",\"html_url\":\"https://github.com/testgh3py\",\"followers_url\":\"https://api.github.com/users/testgh3py/followers\",\"following_url\":\"https://api.github.com/users/testgh3py/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/testgh3py/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/testgh3py/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/testgh3py/subscriptions\",\"organizations_url\":\"https://api.github.com/users/testgh3py/orgs\",\"repos_url\":\"https://api.github.com/users/testgh3py/repos\",\"events_url\":\"https://api.github.com/users/testgh3py/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/testgh3py/received_events\",\"type\":\"Organization\",\"site_admin\":false},\"private\":false,\"html_url\":\"https://github.com/testgh3py/archive-me\",\"description\":null,\"fork\":false,\"url\":\"https://api.github.com/repos/testgh3py/archive-me\",\"forks_url\":\"https://api.github.com/repos/testgh3py/archive-me/forks\",\"keys_url\":\"https://api.github.com/repos/testgh3py/archive-me/keys{/key_id}\",\"collaborators_url\":\"https://api.github.com/repos/testgh3py/archive-me/collaborators{/collaborator}\",\"teams_url\":\"https://api.github.com/repos/testgh3py/archive-me/teams\",\"hooks_url\":\"https://api.github.com/repos/testgh3py/archive-me/hooks\",\"issue_events_url\":\"https://api.github.com/repos/testgh3py/archive-me/issues/events{/number}\",\"events_url\":\"https://api.github.com/repos/testgh3py/archive-me/events\",\"assignees_url\":\"https://api.github.com/repos/testgh3py/archive-me/assignees{/user}\",\"branches_url\":\"https://api.github.com/repos/testgh3py/archive-me/branches{/branch}\",\"tags_url\":\"https://api.github.com/repos/testgh3py/archive-me/tags\",\"blobs_url\":\"https://api.github.com/repos/testgh3py/archive-me/git/blobs{/sha}\",\"git_tags_url\":\"https://api.github.com/repos/testgh3py/archive-me/git/tags{/sha}\",\"git_refs_url\":\"https://api.github.com/repos/testgh3py/archive-me/git/refs{/sha}\",\"trees_url\":\"https://api.github.com/repos/testgh3py/archive-me/git/trees{/sha}\",\"statuses_url\":\"https://api.github.com/repos/testgh3py/archive-me/statuses/{sha}\",\"languages_url\":\"https://api.github.com/repos/testgh3py/archive-me/languages\",\"stargazers_url\":\"https://api.github.com/repos/testgh3py/archive-me/stargazers\",\"contributors_url\":\"https://api.github.com/repos/testgh3py/archive-me/contributors\",\"subscribers_url\":\"https://api.github.com/repos/testgh3py/archive-me/subscribers\",\"subscription_url\":\"https://api.github.com/repos/testgh3py/archive-me/subscription\",\"commits_url\":\"https://api.github.com/repos/testgh3py/archive-me/commits{/sha}\",\"git_commits_url\":\"https://api.github.com/repos/testgh3py/archive-me/git/commits{/sha}\",\"comments_url\":\"https://api.github.com/repos/testgh3py/archive-me/comments{/number}\",\"issue_comment_url\":\"https://api.github.com/repos/testgh3py/archive-me/issues/comments{/number}\",\"contents_url\":\"https://api.github.com/repos/testgh3py/archive-me/contents/{+path}\",\"compare_url\":\"https://api.github.com/repos/testgh3py/archive-me/compare/{base}...{head}\",\"merges_url\":\"https://api.github.com/repos/testgh3py/archive-me/merges\",\"archive_url\":\"https://api.github.com/repos/testgh3py/archive-me/{archive_format}{/ref}\",\"downloads_url\":\"https://api.github.com/repos/testgh3py/archive-me/downloads\",\"issues_url\":\"https://api.github.com/repos/testgh3py/archive-me/issues{/number}\",\"pulls_url\":\"https://api.github.com/repos/testgh3py/archive-me/pulls{/number}\",\"milestones_url\":\"https://api.github.com/repos/testgh3py/archive-me/milestones{/number}\",\"notifications_url\":\"https://api.github.com/repos/testgh3py/archive-me/notifications{?since,all,participating}\",\"labels_url\":\"https://api.github.com/repos/testgh3py/archive-me/labels{/name}\",\"releases_url\":\"https://api.github.com/repos/testgh3py/archive-me/releases{/id}\",\"deployments_url\":\"https://api.github.com/repos/testgh3py/archive-me/deployments\",\"created_at\":\"2018-01-07T12:31:46Z\",\"updated_at\":\"2018-01-07T12:31:46Z\",\"pushed_at\":\"2018-01-07T12:31:46Z\",\"git_url\":\"git://github.com/testgh3py/archive-me.git\",\"ssh_url\":\"git@github.com:testgh3py/archive-me.git\",\"clone_url\":\"https://github.com/testgh3py/archive-me.git\",\"svn_url\":\"https://github.com/testgh3py/archive-me\",\"homepage\":\"\",\"size\":0,\"stargazers_count\":0,\"watchers_count\":0,\"language\":null,\"has_issues\":true,\"has_projects\":true,\"has_downloads\":true,\"has_wiki\":true,\"has_pages\":false,\"forks_count\":0,\"mirror_url\":null,\"archived\":false,\"open_issues_count\":0,\"license\":null,\"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,\"organization\":{\"login\":\"testgh3py\",\"id\":35038710,\"avatar_url\":\"https://avatars1.githubusercontent.com/u/35038710?v=4\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/testgh3py\",\"html_url\":\"https://github.com/testgh3py\",\"followers_url\":\"https://api.github.com/users/testgh3py/followers\",\"following_url\":\"https://api.github.com/users/testgh3py/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/testgh3py/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/testgh3py/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/testgh3py/subscriptions\",\"organizations_url\":\"https://api.github.com/users/testgh3py/orgs\",\"repos_url\":\"https://api.github.com/users/testgh3py/repos\",\"events_url\":\"https://api.github.com/users/testgh3py/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/testgh3py/received_events\",\"type\":\"Organization\",\"site_admin\":false},\"network_count\":0,\"subscribers_count\":0}"}, "headers": {"Server": "GitHub.com", "Date": "Sun, 07 Jan 2018 12:31:46 GMT", "Content-Type": "application/json; charset=utf-8", "Content-Length": "5836", "Status": "201 Created", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4998", "X-RateLimit-Reset": "1515331906", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "ETag": "\"043f3f39cdd0a8f8deb8e810e31a940c\"", "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user", "X-Accepted-OAuth-Scopes": "public_repo, repo", "Location": "https://api.github.com/repos/testgh3py/archive-me", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Access-Control-Expose-Headers": "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Access-Control-Allow-Origin": "*", "Content-Security-Policy": "default-src 'none'", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "X-Runtime-rack": "0.613721", "X-GitHub-Request-Id": "BC06:2D7EB:F7DD3A:1EDD365:5A521332"}, "status": {"code": 201, "message": "Created"}, "url": "https://api.github.com/orgs/testgh3py/repos"}, "recorded_at": "2018-01-07T12:31:46"}, {"request": {"body": {"encoding": "utf-8", "string": "{\"name\": \"i-have-been-archived\", \"archived\": true}"}, "headers": {"User-Agent": "github3.py/1.0.0a4", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "Connection": "keep-alive", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>", "Content-Length": "50"}, "method": "PATCH", "uri": "https://api.github.com/repos/testgh3py/archive-me"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA+2YzXLbOAzH30XXdcK4btOsZ3baN+hlT3vx0BItcSORWp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r7dfHf7CmqbOra+rGFlcwSNxdIOATJi+/G3v8tlWjgQrUsLYY5X+O0tvLM6JOOi3h0WeBeLMGx/N7dzEB+he6EjVKpTA2svIVnzCVmlQ6qW4U3gMenrhDKY8aYnzUV0d9O1xwuwtZIdk601DLjSe10f+K1NnpszEhTRae5LOcCVIRN7TXoTUeN6+kMbobnYVufJjXdUxdC9XpM1VapkJZHHRs4bEJDjhZPjuw/5KJA29KtwvNB+xVcesw5cOUQZgKh6ZZD838uhlEOD65YH8iSmrhM0YTSAT6tLP/NRwe5G+Vfln4xT+C0lT/zH8xgq63ucx0SvQ5dxxj73PuOM6UL09oP+eO86k4irDZ0BJxvnzuqIQ7Yf42yTnTFqzPYG//A7FfNtODGAAA", "string": ""}, "headers": {"Server": "GitHub.com", "Date": "Sun, 07 Jan 2018 12:31:46 GMT", "Content-Type": "application/json; charset=utf-8", "Transfer-Encoding": "chunked", "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4997", "X-RateLimit-Reset": "1515331906", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "ETag": "W/\"af8a1d47af7ef612c540ce2a0a9934ae\"", "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user", "X-Accepted-OAuth-Scopes": "", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Access-Control-Expose-Headers": "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Access-Control-Allow-Origin": "*", "Content-Security-Policy": "default-src 'none'", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "X-Runtime-rack": "0.235793", "Content-Encoding": "gzip", "X-GitHub-Request-Id": "BC06:2D7EB:F7DD58:1EDD3AA:5A521332"}, "status": {"code": 200, "message": "OK"}, "url": "https://api.github.com/repos/testgh3py/archive-me"}, "recorded_at": "2018-01-07T12:31:47"}, {"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": "github3.py/1.0.0a4", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "Connection": "keep-alive", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>", "Content-Length": "0"}, "method": "DELETE", "uri": "https://api.github.com/repos/testgh3py/i-have-been-archived"}, "response": {"body": {"encoding": null, "string": ""} 8000 , "headers": {"Server": "GitHub.com", "Date": "Sun, 07 Jan 2018 12:31:47 GMT", "Content-Type": "application/octet-stream", "Status": "204 No Content", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4996", "X-RateLimit-Reset": "1515331906", "X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user", "X-Accepted-OAuth-Scopes": "delete_repo", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Access-Control-Expose-Headers": "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Access-Control-Allow-Origin": "*", "Content-Security-Policy": "default-src 'none'", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "X-Runtime-rack": "0.066993", "X-GitHub-Request-Id": "BC06:2D7EB:F7DD62:1EDD3BC:5A521332"}, "status": {"code": 204, "message": "No Content"}, "url": "https://api.github.com/repos/testgh3py/i-have-been-archived"}, "recorded_at": "2018-01-07T12:31:47"}], "recorded_with": "betamax/0.8.0"}

tests/integration/test_repos_repo.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,18 @@ def test_edit(self):
581581
repository = self.gh.repository('github3py', 'github3.py')
582582
assert repository.edit('github3py') is True
583583

584+
def test_archive_a_repository(self):
585+
"""Verify we can archive a repository."""
586+
self.token_login()
587+
cassette_name = self.cassette_name('archive_a_repository')
588+
with self.recorder.use_cassette(cassette_name):
589+
organization = self.gh.organization('testgh3py')
590+
repository = organization.create_repository('archive-me')
591+
assert repository.archived is False
592+
repository.edit(name='i-have-been-archived', archived=True)
593+
assert repository.archived is True
594+
repository.delete()
595+
584596
def test_events(self):
585597
"""Test that a user can iterate over the events from a repository."""
586598
cassette_name = self.cassette_name('events')

0 commit comments

Comments
 (0)
0