-
Notifications
You must be signed in to change notification settings - Fork 406
Migrate TestTree from tests/test_git.py to tests/integration + tests/unit #467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2b9eb47
Initial commit of migrating test_git.py to unit/test_git.py
itsmemattchung 697a8ff
Removed class Tree from test_git.py and migrated it to integration test
itsmemattchung 5435bd9
Removed 'u' from test, which is causing failure in Python 3.2
itsmemattchung 21590e8
Updated tree_example with octocat/Hello-World
itsmemattchung 25a232f
Merge branch 'develop' into develop
itsmemattchung File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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": "H4sIAAAAAAAAA62YT4/yNhDGvwrKtSwmsJTdSNXbntre3sPbSy/ISUxibRJHtgNio/3ufWznL1VhWfeCIHh+fjyecWbcBjwNou0+XO/DcBlUtGRBFGRc5028XdWXYBkcm6I4dH8onpX0xGWjNs9kNkqcKyaDqA0KkfEKjOlQUMw0m+f1y3a9DOiJaioPjSwwLte6VhEh7qFaOWqjmExEpVmlV4koSUOc8bfTL1vQMtkxDDbAgytWzTuOMwZMkStBuS6LK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rz+vAzOVKN2xat3+rAvJIamz0xN1cGlaRBp2ZiuEk/GY2Dy8Mzf+Nh7YpSRrHoz18V104W7Hc5NLqXobogqpC1uAGpWdbP1wnZYg+vfIms0GRJE5s9+Jd3CUnakTaEPrp7GSlI0AoWosZSK6TM6wZ5scdMqpNO22X38A7CV0ykxEwAA", "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/\"87634f23b0e88ce76f4b914d98b73a6e\"", "cache-control": "public, max-age=60, s-maxage=60", "status": "200 OK", "x-ratelimit-remaining": "50", "x-served-by": "2d7a5e35115884240089368322196939", "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": "D56988B9:94AF:14509ED0:563E2297", "access-control-allow-credentials": "true", "last-modified": "Sat, 07 Nov 2015 08:27:31 GMT", "date": "Sat, 07 Nov 2015 16:11:03 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": "1446914388"}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/sigmavirus24/github3.py"}, "recorded_at": "2015-11-07T16:11:03"}, {"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/git/trees/75b347329e3fc87ac78895ca1be58daff78872a1"}, "response": {"body": {"string": "", "base64_string": "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lFCTfewVKNULtTmUuWKQzneKhbtNeRsF0d9Ge8llq9y5WnzBdx31nlidSXMskMXFaOnZeofDaCO99mznspkXe7XrW0MBQAx/fT4/PvxWi7//Y4a6XF+tX2rbPXY+jvr+P9z5wvOXDwAA", "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/\"c437e45ae4910fcfbc7a3b8c141ea5e3\"", "cache-control": "public, max-age=60, s-maxage=60", "status": "200 OK", "x-ratelimit-remaining": "49", "x-served-by": "07ff1c8a09e44b62e277fae50a1b1dc4", "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": "D56988B9:94AF:14509F1B:563E2297", "access-control-allow-credentials": "true", "last-modified": "Sat, 07 Nov 2015 08:27:31 GMT", "date": "Sat, 07 Nov 2015 16:11:03 GMT", "access-control-allow-origin": "*", "content-security-policy": "default-src 'none'", "content-encoding": "gzip", "strict-transport-security": "max-age=31536000; includeSubdomains; preload", "server& 8000 quot;: "GitHub.com", "x-ratelimit-limit": "60", "x-frame-options": "deny", "content-type": "application/json; charset=utf-8", "x-ratelimit-reset": "1446914388"}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/sigmavirus24/github3.py/git/trees/75b347329e3fc87ac78895ca1be58daff78872a1"}, "recorded_at": "2015-11-07T16:11:03"}, {"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/git/trees/75b347329e3fc87ac78895ca1be58daff78872a1?recursive=1"}, "response":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LWXMEK1vcsIhWSRvWWfcXlzmIO1Iqc024mYCu2Yb332Pbr56R54JMmYp66u6zoY7BeEaln8RiyzYFo1Ybnx/bq04Twf4fzdU4alv4P5Gc9na3srJkOyZkVRUYBSaVat6AgHc3HsbkdyeZxzLsRXt0p4Fbme1j6XeqWJ50OD3qe8sPTipLks6vWWBxXbHNd6lZj0TtzPeiFi1Upc+fcr2PxXLE2ivew9vvkFxu11nUZQyrJm9NT65tdlag0hLkyiReXuViPNTt7dQuAspUbGtZ+F/rwOOnpOa+xEGzFV1yC3qqCrXG4mhG0rQErSYy5YQuVW796wEB+o0APS7/LfNJb/WfN0Q6JbXmFvSlBQYyWyamX2K2KSSkBXMRY9FrJrDdvdrRHtd8lnhP68/FxldOnhIRmg82/h5qs3dYcRQo3aNVcsVj/ghTqW/kGpK0MlM1NY9rvQl+mw/1hWuH9gy25OCl2a8VoNYyiC8GlzpBysQ7dpdkwztfRG2Crzd6w9K+I1/dmZHWS5hEcJfd5SLUDbhar2nKPNHZ759Dh6o7DViuGYeUl6OV+TX0qlAuDOY+atGrITYt5Yp+ys25E1dy/HWcHixEHMWxljofFF3zf1tzjI2r1VnpqModhRpLbvP5yYpAOzWRYOG2fYkN3wLfMDJJkK5MxLL7gu5zNR43zJdYUBFK17LM9pU1pjoItT4odVE7Npp5e7PP1cALQZh1mWPzrXza6nC6PNplq233q1kL167/hoORpARkAAA==", "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/\"c055cd9cc7a8565302960f5afbc930fd\"", "cache-control": "public, max-age=60, s-maxage=60", "status": "200 OK", "x-ratelimit-remaining": "48", "x-served-by": "dc1ce2bfb41810a06c705e83b388572d", "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": "D56988B9:94AF:14509F44:563E2297", "access-control-allow-credentials": "true", "last-modified": "Sat, 07 Nov 2015 08:27:31 GMT", "date": "Sat, 07 Nov 2015 16:11:03 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": "1446914388"}, "status": {"message": "OK", "code": 200}, "url": "https://api.github.com/repos/sigmavirus24/github3.py/git/trees/75b347329e3fc87ac78895ca1be58daff78872a1?recursive=1"}, "recorded_at": "2015-11-07T16:11:04"}], "recorded_with": "betamax/0.5.0"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
"""Integration tests for Tree.""" | ||
import github3 | ||
from .helper import IntegrationHelper | ||
|
||
|
||
class TestTree(IntegrationHelper): | ||
|
||
"""Integration tests for methods on the Test class.""" | ||
|
||
def test_recurse(self): | ||
"""Test recurse on tree""" | ||
cassette_name = self.cassette_name('recurse') | ||
with self.recorder.use_cassette(cassette_name): | ||
repository = self.gh.repository('sigmavirus24', 'github3.py') | ||
t = repository.tree('75b347329e3fc87ac78895ca1be58daff78872a1').recurse() | ||
assert isinstance(t.tree[0], github3.git.Hash) | ||
assert repr(t.tree[0]).startswith('<Hash') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8000
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import github3 | ||
|
||
from .helper import (UnitHelper, create_example_data_helper, create_url_helper) | ||
|
||
get_example_data = create_example_data_helper('tree_example') | ||
url_for = create_url_helper('https://api.github.com/repos/octocat/Hello-World/' | ||
'trees/9fb037999f264ba9a7fc6274d15fa3ae2ab98312') | ||
|
||
|
||
class TestTree(UnitHelper): | ||
"""Tree unit test""" | ||
|
||
described_class = github3.git.Tree | ||
example_data = get_example_data() | ||
|
||
def test_repr(self): | ||
"""Assert Tree in in the repr.""" | ||
assert isinstance(self.instance, github3.git.Tree) | ||
assert repr(self.instance).startswith('<Tree') | ||
|
||
def test_recurse(self): | ||
"""Assert that URL is called""" | ||
self.instance.recurse() | ||
self.session.get.assert_called_once_with( | ||
url_for(), | ||
params={'recursive': '1'} | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"sha": "9fb037999f264ba9a7fc6274d15fa3ae2ab98312", | ||
"url": "https://api.github.com/repos/octocat/Hello-World/trees/9fb037999f264ba9a7fc6274d15fa3ae2ab98312", | ||
"tree": [ | ||
{ | ||
"path": "file.rb", | ||
"mode": "100644", | ||
"type": "blob", | ||
"size": 30, | ||
"sha": "44b4fc6d56897b048c772eb4087f854f46256132", | ||
"url": "https://api.github.com/repos/octocat/Hello-World/git/blobs/44b4fc6d56897b048c772eb4087f854f46256132" | ||
}, | ||
{ | ||
"path": "subdir", | ||
"mode": "040000", | ||
"type": "tree", | ||
"sha": "f484d249c660418515fb01c2b9662073663c242e", | ||
"url": "https://api.github.com/repos/octocat/Hello-World/git/blobs/f484d249c660418515fb01c2b9662073663c242e" | ||
}, | ||
{ | ||
"path": "exec_file", | ||
"mode": "100755", | ||
"type": "blob", | ||
"size": 75, | ||
"sha": "45b983be36b73c0788dc9cbcb76cbb80fc7bb057", | ||
"url": "https://api.github.com/repos/octocat/Hello-World/git/blobs/45b983be36b73c0788dc9cbcb76cbb80fc7bb057" | ||
} | ||
], | ||
"truncated": false | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I try to use the data from the documentation, e.g., this data. This will necessitate updating the URL you have in the unit test file though. Cheers!