8000 Merge pull request #554 from itsmemattchung/tests/migrate-repos · pythonthings/github3.py@84d1c45 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 84d1c45

Browse files
committed
Merge pull request sigmavirus24#554 from itsmemattchung/tests/migrate-repos
Migrated tests cases to tests/{unit, integration}
2 parents 35932cf + 07a2d73 commit 84d1c45

File tree

8 files changed

+118
-70
lines changed

8 files changed

+118
-70
lines changed

github3/repos/contents.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ def delete(self, message, branch=None, committer=None, author=None):
116116
'author': validate_commmitter(author)}
117117
self._remove_none(data)
118118
json = self._json(self._delete(self._api, data=dumps(data)), 200)
119-
if 'commit' in json:
119+
if json and 'commit' in json:
120120
json['commit'] = Commit(json['commit'], self)
121-
if 'content' in json:
121+
if json and 'content' in json:
122122
json['content'] = self._instance_or_null(Contents,
123123
json['content'])
124124
return json

github3/repos/repo.py

Original file line numberDiff line numberDiff line change
@@ -1935,12 +1935,12 @@ def weekly_commit_count(self):
19351935
"""
19361936
url = self._build_url('stats', 'participation', base_url=self._api)
19371937
resp = self._get(url)
1938-
if resp.status_code == 202:
1938+
if resp and resp.status_code == 202:
19391939
return {}
19401940
json = self._json(resp, 200)
1941-
if json.get('ETag'):
1941+
if json and json.get('ETag'):
19421942
del json['ETag']
1943-
if json.get('Last-Modified'):
1943+
if json and json.get('Last-Modified'):
19441944
del json['Last-Modified']
19451945
return json
19461946

tests/cassettes/Contents_delete.json

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.0a2", "Accept-Charset": "utf-8", "Connection": "keep-alive", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>"}, "method": "GET", "uri": "https://api.github.com/repos/github3py/delete_contents"}, "response": {"body": {"string": "", "base64_string": "H4sIAAAAAAAAA+2YzW7bOhCFX8XQ9rqmnbRuYaDofYO76aobg5JoiQglCiRlwyHy7j0k9WffILLDLAMEgSxxPh4NOdTM2ITnye7b+uuP7cPjepnUtGLJLsmZYIbtM1kbVhudLJNDK8S+e1pwU7bpY3Mm/x8nTzVTyc4mQha8BmoYDIiba/P9x8Pm23aZ0CM1VO1bJTCqNKbRO0LCTb0KVq1mqtOwymRFWtJZ/zr+fASvUB3EgRPcuII1vAMFa9A0meopTSWuBITHfvx05EEKIU+wv9b75hRkMHMe9AheF+9BwMwSaUoGh+E1XtzLc23ulONNLF5Mmz3PHURjCRTL75PUGUGQW+wXSxRrpKe1qc4UbwyX9Z3SLkyBkqqgNX+m70DB1O1YJ+pOEd4Epuzodv19Tgk2ljSKH2l2du5QLGP8CO++h3dlDJw5Ny42/5t4xvmcI1BpXrlgO1Ch2csy8RoMBvsbS0TXTfv8lXDO2bCgmPp3yfUCf4ZVjVRUcXFeYDvmi/S86KJl1ZwXB6kWHCcHwtMtH4Zrgw0MsXjyNKh6M1j9Uowh+Io0x5pZoxkIwhMIyHpi50iSI1iC/11cZQh2msJHRs6dGXMiL1CWTH+6TWYYrSLFewRQpZSxHvUIoLjWLbtp38+9vidp0odX3VZpOP9uCao5eGBAL9WaFzVjkZ4cMJb0x3SqaJ2VseCeYkm48itPi0i5jgBQKmQaSUL0E4+xRJc0fJ7MPl6h4zrKBVaxwwfIdZQBa1T02nupDjNA8Z002AaRWnsKsZ1nBa2Llhax3AGDHeC+6AV9ns1v5uJp5ADqMjfF0/YjjsCR5NSGNAPnQKxrR9CI9dnL29/+WTdM8iDviKric/nEHLODXATCh4Ddvr2Gu9/zKdAtkh3FkvHUDh+Gjh/n5e7L0GudztIXLnET9BRi/2moKd2phskaqlgs10OITSnStdVqZUtGfTpeMRUd14EBGFVZifQzTqvtKciVKmp8sn9wUnMk/0LSPDIEBwyQYUHj9AbGdC80qFwjRXrElFlxgZxW1rFn8MiZ0mtp+IFnt9Q+cyF4gbK/NK8ztqRCLLEBDc849jUyc7eeSFdZrJ8CA6+CLkIogATDFo/0vkIzwlEsCTVrzhohzx9wPk1ALrQVQ82U76lBpfOw3my/rDdfHr7/Xm93m+3u6/YPxrRNPjumaXU5g8GR2+1yXKHrEWqny6bDdcXjOhlQoHU5mv47Gu7C5StNmc4wE9iuV7F1z7zH62/iLcYQXMqKNchWkl2NKHL16jOu0Wqa5ByZbGt4HTdP1CBZxnd9vNXnKT2gpHofojzZGdW68hZ3xnNkcvPEn/h0kNOhh/ozFJDjRBVXSnYNqaBVNqzu5poIClWjUzt5fqHe/8jZgbbC7EPCjj1VUW3QG0N5zlSFN0CaATE26Yr38C5u9/SS3bETrlHTTxsin/21rv/42V8bO6dvdyI/+2uX3V+kMRfNOYTl7f21mpkTWkeTM2FaknQnyublLz1XlkZdFwAA", "encoding": "utf-8"}, "headers": {"vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "x-github-media-type": "github.v3; param=full; format=json", "x-oauth-scopes": "admin:public_key, gist, repo, user", "x-xss-protection": "1; mode=block", "x-content-type-options": "nosniff", "x-accepted-oauth-scopes": "repo", "etag": "W/\"f4de1d3e6758ef37ba4c516ec79ec972\"", "cache-control": "private, max-age=60, s-maxage=60", "status": "200 OK", "x-ratelimit-remaining": "4993", "x-served-by": "7b641bda7ec2ca7cd9df72d2578baf75", "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": "97E45D32:135D3:6A62232:56A8616D", "access-control-allow-credentials": "true", "last-modified": "Wed, 27 Jan 2016 06:16:46 GMT", "date": "Wed, 27 Jan 2016 06:19:25 GMT", "access-control-allow-origin": "*", "content-security-policy": "default-src 'none'", "content-encoding": "gzip", "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": "1453878422"}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/github3py/delete_contents"}, "recorded_at": "2016-01-27T06:19:25"}, {"request": {"body": {"string": "", "encoding": "utf-8"}, "headers": {"Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "User-Agent": "github3.py/1.0.0a2", "Accept-Charset": "utf-8", "Connection": "keep-alive", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>"}, "method": "GET", "uri": "https://api.github.com/repos/github3py/delete_contents/readme"}, "response": {"body": {"string": "", "base64_string": "H4sIAAAAAAAAA7WSXWvCMBSG/0uuxfTDj1UYYzJXq3jjQFEESfNhuyZpaFJcJ/73pVPEybzQsYuQ8EKe95z3nB2QSFDQA9PB88tk0BQENIBCJrmQdIKs4gU+8pnHsO/Hvuch6nYZ85wAd1wHEUa7rS4h7TayDJ1+WuyD2wBlwe3XxBilexAilTY3qUnKuIlzAQuqcg0Pgq8qSCinhq5xLg2VRsPT41TfU0HZo0Da0MLaJEbw9U+HM/p1bszzGB4o8Lx1++MCd2PBFgBruIY3hEXyreQ5IhfWBdoesyo1LY5RfMd2vbFfejKVqifMUk5tYkeMFaKqny3nH5yEM7bwgtLeJRlOxrMwUbjq18dZzt1t7I8SLLimb30Xe7MsCkftlYxCokiYuIv3SYmH2WYpgioKeU2RWLw6aB6U0XDKsT9VscDjlbTmVOKcpHJj3WOkaadltTVPZaZBbwc05ez/VsVmdj/8rrHWy3lm+YfF3O+/AFUXR1upAwAA", "encoding": "utf-8"}, "headers": {"vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "x-github-media-type": "github.v3; param=full; format=json", "x-oauth-scopes": "admin:public_key, gist, repo, user", "x-xss-protection": "1; mode=block", "x-content-type-options": "nosniff", "x-accepted-oauth-scopes": "", "etag": "W/\"e61c42dbb02e81cf5d49f612ab0304ea\"", "cache-control": "private, max-age=60, s-maxage=60", "status": "200 OK", "x-ratelimit-remaining": "4992", "x-served-by": "d594a23ec74671eba905bf91ef329026", "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": "97E45D32:135D3:6A62260:56A8616D", "access-control-allow-credentials": "true", "last-modified": "Wed, 27 Jan 2016 06:16:46 GMT", "date": "Wed, 27 Jan 2016 06:19:26 GMT", "access-control-allow-origin": "*", "content-security-policy": "default-src 'none'", "content-encoding": "gzip", "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": "1453878422"}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/github3py/delete_contents/readme"}, "recorded_at": "2016-01-27T06:19:25"}, {"request": {"body": {"string": "{\"sha\": \"293a3f2fc33b322ae17ff209c610adfe747dd55a\", \"message\": \"Deleting readme from repository\"}", "encoding": "utf-8"}, "headers": {"Content-Length": "97", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "User-Agent": "github3.py/1.0.0a2", "Accept-Charset": "utf-8", "Connection": "keep-alive", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>"}, "method": "DELETE", "uri": "https://api.github.com/repos/github3py/delete_contents/contents/README.md"}, "response": {"body": {"string": "", "base64_string": "H4sIAAAAAAAAA7WSwU7DMAyGX2XKeaNJ2qRdT0hw5cYJhFCSOm2lpq0a9zChvTsOYxIckJgYt9iO8/l3/jfmphFhRFaP6zBsKQyhp+iNxc6wmlmjpNGCOyWVdCBkDhUvfSWtVuCgorJvQAi2ZesyUEOHOMc6y8zc37Q9dqu9oTezBeYpZqdEPh+yBgZAeP2kf1SyEztmFzA7DMPrd/AX6M+4E+oSklmxm5a0mNEEIKEPBnFz161jS9ohmD6p7zEGOiO6VLhtUzrppyuNwdQmudA7LnayfOS6Fvta6id2PC8e4R8RuABNcP7ZwlZSNU4X0lkNdm+45qAK66tG72VVeQtQ7HlxjZ9N5Jj9mkjrCBCjadPC7pNT+rHdLGCaABu/TIHOZKcep+VA481mIQdHVj+ftZVO6Ebk3goyqjLO5xSXUhjpSl7k3BtV+TxX19B2du0FzD+69tek48vx+A5O0iMi4gMAAA==", "encoding": "utf-8"}, "headers": {"vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "x-github-media-type": "github.v3; param=full; format=json", "x-oauth-scopes": "admin:public_key, gist, repo, user", "x-xss-protection": "1; mode=block", "x-content-type-options": "nosniff", "x-accepted-oauth-scopes": "", "etag": "W/\"dee69476834ba2605db71846bd15f8b0\"", "cache-control": "private, max-age=60, s-maxage=60", "status": "200 OK", "x-ratelimit-remaining": "4991", "x-served-by": "a474937f3b2fa272558fa6dc951018ad", "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": "97E45D32:135D3:6A62286:56A8616E", "access-control-allow-credentials": "true", "date": "Wed, 27 Jan 2016 06:19:26 GMT", "access-control-allow-origin": "*", "content-security-policy": "default-src 'none'", "content-encoding": "gzip", "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": "1453878422"}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/github3py/delete_contents/contents/README.md"}, "recorded_at": "2016-01-27T06:19:25"}], "recorded_with": "betamax/0.5.0"}
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.0a2", "Accept-Charset": "utf-8", "Connection": "keep-alive", "Content-Type": "application/json"}, "method": "GET", "uri": "https://api.github.com/repos/sigmavirus24/github3.py"}, "response": {"body": {"string": "", "base64_string": "H4sIAAAAAAAAA62YTY+jOBCG/0rEddNxIOlOD9JoZk+7e5vD7GUvkQEnWA0Y2SZRGvV/39c2EMho89HeS5QQ1+PXZVdR5TbgWRCvNuFyE4bzoKIlC+Jgz3XeJKtFfQrmwa4pim33h+L7kh64bFS0JpNR4lgxGcRtUIg9r8AYDwXFTBOtl6+r5TygB6qp3DaywLhc61rFhLiHauGojWIyFZVmlV6koiQNccbfDl9XoO1lxzDYAA8uWDXvOM4YMEUuBOW6LC4kuKmtycXgnSgKcQTlUvStichgaTxpKbzaf5ICy5YInTP4Dkv6MI7gSj8uylq12ECltzwzHIUNkSx7WFhnB1lm/z9aIlktLLBJVCp5rbmoHhc4sQZNyD2t+Dv9HA3WChAj7XEp1grW7ICz+Li5M2tJLfmBpifjGslSxg9w9ieRF/Yg6lNtwvZvHArjeq7ZlmalCcMdLRT7mAd2eo1B9sEcUXfv6Z+GecaGXcWEP046F9Ws4Imk8jTbCTnjiFm5oynO6uyINDLDcZ39wfWfTTL7/cdfBxO9GPc2KLkaudb5k2CcyjGkG3tyFYHwBACS3tjJi2PsW4LPLp5ShDpNhKRa3Eoa1wVOQC0Z/zRnSTNaegm3AIByIfw8aQEAcaUadtfRvr5wy1Gkj5+qKROX8u6JmutoR4BWqpDnK8a8PDhAWtJnZYRDleZ+2J7REvfN7jbde0k19sAkhUi8OHhREgtpicqpew/pra86QzWMCVSynbdUwxigWnrut5VpIAMSL0GNrffS2TNI23m0oNW+oXs/6gDBrptX9Z6+3yxirsfOmQKkqdAkTxr/JHfmGKWudkC8+7n0jDlDbUFyvcy54YBRYWNdUJb8Vl1wndghJsf+f8Cac3qJNr9vlzG35RpGS8452SX9ju7j3S7r9zrHc3TtgNeR6Bmk/a2mOjeZC1PVVDIf0R2CtAlFsbVYLNqcUVtWl0x6RrAjAEVlmqNq9NHZ9gxUPSXVtlrfGZkZqvdC0MzLtwMEQLeNPlodYbz/NfpQL4EWMCaWvGBKi8ovx54pY3YlNN/x9J6O5Xq4TUDtN8WrlM1pUcxxajVPOc4xam2ziyg4mZ+HHAHLwDWA61QKhiPt5XXJHKMlrtPMWF2Ik3cWGmFMEEuG7ibbUo2uJFqG0dNy9RSufoZf4ufX+Hn1D8Y0dTYZ8/K0DJ+i55/hOl5FcRSaMXWj8hFmNCRaxesXMwRptTvX+IZ7C3ziruSXS4NRn2KuImCoVH42/H42i//jUqUzSwsc0ItIun/Ow+W77rYppOaiZDVqj+56Zljlqj4t4OkMPV0mUrVAY03Myvg7hm7Wr+tJlZGKpsJ+rF+ieXCkGgUx3ufjh311MnSSZmqqti72g1jLxrSqeHLOLaOHR/7Gzw0tRhnJqjdzrWE3XfiyQTLmUoru2qlCLsC1Qs2qbrZB2BfXn4JjjUZDsBT82a+kW1jGdrQp9NYV6VhJhu6iEDWWUjF9RHvZky1uXNp02qLNx79dsvZ8hhMAAA==", "encoding": "utf-8"}, "headers": {"vary": "Accept", "x-github-media-type": "github.v3; param=full; format=json", "x-xss-protection": "1; mode=block", "x-content-type-options": "nosniff", "etag": "W/\"eea9c6b902a54f69403bc3d31368cf6e\"", "cache-control": "public, max-age=60, s-maxage=60", "status": "200 OK", "x-ratelimit-remaining": "59", "x-served-by": "ef96c2e493b28ffea49b891b085ed2dd", "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": "97E45D32:2075:91E4D0A:56A71B85", "access-control-allow-credentials": "true", "last-modified": "Mon, 25 Jan 2016 14:32:21 GMT", "date": "Tue, 26 Jan 2016 07:08:53 GMT", "access-control-allow-origin": "*", "content-security-policy": "default-src 'none'", "content-encoding": "gzip", "strict-transport-security": "max-age=31536000; includeSubdomains; preload", "server": "GitHub.com", "x-ratelimit-limit": "60", "x-frame-options": "deny", "content-type": "application/json; charset=utf-8", "x-ratelimit-reset": "1453795733"}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/sigmavirus24/github3.py"}, "recorded_at": "2016-01-26T07:08:53"}, {"request": {"body": {"string": "", "encoding": "utf-8"}, "headers": {"Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "User-Agent": "github3.py/1.0.0a2", "Accept-Charset": "utf-8", "Connection": "keep-alive", "Content-Type": "application/json"}, "method": "GET", "uri": "https://api.github.com/repos/sigmavirus24/github3.py/stats/participation"}, "response": {"body": {"string": "", "base64_string": "H4sIAAAAAAAAA01Ouw6DQAz7l5s9kIS7cv2VioGhGyoSS4eq/147FAlFcp6O/SnLupb7Y4BjhBmTypq5cjRkbxmNNU8iVxzy+lgLzwjub7BAR/CgwyZ9dnhDOFcBZ89PbUbZ3q/nftU3aTCkH399zRQSJps4EuXyKnxaSWOToFNNDJo9yI3EOn9/ovZ2SfUAAAA=", "encoding": "utf-8"}, "headers": {"vary": "Accept", "x-github-media-type": "github.v3; param=full; format=json", "x-xss-protection": "1; mode=block", "x-content-type-options": "nosniff", "etag": "W/\"2f25f55f3c8deb081262470b972b3304\"", "cache-control": "public, max-age=60, s-maxage=60", "status": "200 OK", "x-ratelimit-remaining": "58", "x-served-by": "a7f8a126c9ed3f1c4715a34c0ddc7290", "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": "97E45D32:2075:91E4D3D:56A71B85", "access-control-allow-credentials": "true", "date": "Tue, 26 Jan 2016 07:08:53 GMT", "access-control-allow-origin": "*", "content-security-policy": "default-src 'none'", "content-encoding": "gzip", "strict-transport-security": "max-age=31536000; includeSubdomains; preload", "server": "GitHub.com", "x-ratelimit-limit": "60", "x-frame-options": "deny", "content-type": "application/json; charset=utf-8", "x-ratelimit-reset": "1453795733"}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/sigmavirus24/github3.py/stats/participation"}, "recorded_at": "2016-01-26T07:08:53"}], "recorded_with": "betamax/0.5.0"}

tests/integration/test_repos_repo.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,3 +1036,33 @@ def test_tree(self):
10361036
tree = repository.tree('52a3f30e05cf434285e775979f01f1a8355049a7')
10371037

10381038
assert isinstance(tree, github3.git.Tree)
1039+
1040+
def test_weekly_commit_count(self):
1041+
"""
1042+
Test the ability to retrieve the weekly commit count on a
1043+
repository.
1044+
"""
1045+
cassette_name = self.cassette_name('weekly_commit_count')
1046+
with self.recorder.use_cassette(cassette_name):
1047+
repository = self.gh.repository('sigmavirus24', 'github3.py')
1048+
weekly_commit_count = repository.weekly_commit_count()
1049+
1050+
assert isinstance(weekly_commit_count, dict)
1051+
assert len(weekly_commit_count.get('owner')) == 52
1052+
assert len(weekly_commit_count.get('all')) == 52
1053+
1054+
1055+
class TestContents(helper.IntegrationHelper):
1056+
1057+
"""Integration test for Contents object."""
1058+
1059+
def test_delete(self):
1060+
"""Test the ability to delete content from a repository."""
1061+
self.token_login()
1062+
cassette_name = self.cassette_name('delete')
1063+
with self.recorder.use_cassette(cassette_name):
1064+
repository = self.gh.repository('github3py', 'delete_contents')
1065+
content = repository.readme()
1066+
deleted = content.delete('Deleting readme from repository')
1067+
1068+
assert deleted

tests/test_repos.py

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,6 @@
44
from github3 import repos
55
from tests.utils import (BaseCase, load, mock)
66

7-
8-
class TestRepository(BaseCase):
9-
def __init__(self, methodName='runTest'):
10 F438 -
super(TestRepository, self).__init__(methodName)
11-
self.repo = repos.Repository(load('repo'))
12-
13-
def setUp(self):
14-
super(TestRepository, self).setUp()
15-
self.repo = repos.Repository(self.repo.as_dict(), self.g)
16-
self.api = 'https://api.github.com/repos/sigmavirus24/github3.py/'
17-
18-
def test_repr(self):
19-
assert repr(self.repo) == '<Repository [sigmavirus24/github3.py]>'
20-
21-
22-
def test_equality(self):
23-
assert self.repo == repos.Repository(load('repo'))
24-
25-
def test_weekly_commit_count(self):
26-
self.response('weekly_commit_count', ETag='"foobarbogus"')
27-
self.request.return_value.headers['Last-Modified'] = 'foo'
28-
self.get(self.api + 'stats/participation')
29-
30-
w = self.repo.weekly_commit_count()
31-
self.assertTrue(w.get('owner') is not None)
32-
self.assertTrue(w.get('all') is not None)
33-
34-
self.mock_assertions()
35-
36-
self.response('', 202)
37-
w = self.repo.weekly_commit_count()
38-
self.assertEqual(w, {})
39-
self.mock_assertions()
40-
41-
427
class TestContents(BaseCase):
438
def __init__(self, methodName='runTest'):
449
super(TestContents, self).__init__(methodName)
@@ -56,35 +21,6 @@ def test_equality(self):
5621
contents.sha = 'fakesha'
5722
assert self.contents != contents
5823

59-
def test_git_url(self):
60-
assert self.contents.links['git'] == self.contents.git_url
61-
62-
def test_html_url(self):
63-
assert self.contents.links['html'] == self.contents.html_url
64-
65-
def test_repr(self):
66-
assert repr(self.contents) == '<Content [{0}]>'.format('README.rst')
67-
68-
@pytest.mark.xfail
69-
def test_delete(self):
70-
self.response('create_content', 200)
71-
self.delete(self.api)
72-
self.conf = {
73-
'data': {
74-
'message': 'foo',
75-
'sha': self.contents.sha,
76-
}
77-
}
78-
79-
self.assertRaises(github3.GitHubError, self.contents.delete, None)
80-
81-
self.not_called()
82-
self.login()
83-
84-
c = self.contents.delete('foo')
85-
assert isinstance(c, github3.git.Commit)
86-
self.mock_assertions()
87-
8824
@pytest.mark.xfail
8925
def test_update(self):
9026
self.response('create_content', 200)

0 commit comments

Comments
 (0)
0