Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5f6189b

Browse files
Migrate Asset.test_str to tests/unit
Created json/asset_example for test_repo_repo
1 parentd7a2907 commit5f6189b

File tree

3 files changed

+52
-3
lines changed

3 files changed

+52
-3
lines changed

‎tests/test_repos.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ def __init__(self, methodName='runTest'):
1212
self.api= ("https://api.github.com/repos/sigmavirus24/github3.py/"
1313
"releases/assets/37945")
1414

15-
deftest_repr(self):
16-
assertrepr(self.asset)=='<Asset [github3.py-0.7.1.tar.gz]>'
17-
1815
@pytest.mark.xfail
1916
deftest_download(self):
2017
headers= {'content-disposition':'filename=foo'}

‎tests/unit/json/asset_example‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/1",
3+
"browser_download_url": "https://github.com/octocat/Hello-World/releases/download/v1.0.0/example.zip",
4+
"id": 1,
5+
"name": "example.zip",
6+
"label": "short description",
7+
"state": "uploaded",
8+
"content_type": "application/zip",
9+
"size": 1024,
10+
"download_count": 42,
11+
"created_at": "2013-02-27T19:35:32Z",
12+
"updated_at": "2013-02-27T19:35:32Z",
13+
"uploader": {
14+
"login": "octocat",
15+
"id": 1,
16+
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
17+
"gravatar_id": "",
18+
"url": "https://api.github.com/users/octocat",
19+
"html_url": "https://github.com/octocat",
20+
"followers_url": "https://api.github.com/users/octocat/followers",
21+
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
22+
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
23+
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
24+
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
25+
"organizations_url": "https://api.github.com/users/octocat/orgs",
26+
"repos_url": "https://api.github.com/users/octocat/repos",
27+
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
28+
"received_events_url": "https://api.github.com/users/octocat/received_events",
29+
"type": "User",
30+
"site_admin": false
31+
}
32+
}

‎tests/unit/test_repos_repo.py‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66
frombase64importb64encode
77
fromgithub3importGitHubError
88
fromgithub3.nullimportNullObject
9+
fromgithub3.repos.releaseimportAsset
910
fromgithub3.repos.repoimport (Comparison,Contents,Hook,RepoComment,
1011
RepoCommit,Repository)
1112
fromgithub3.modelsimportGitHubCore
1213

1314
from .importhelper
1415

16+
asset_url_for=helper.create_url_helper(
17+
'https://api.github.com/repos/octocat/Hello-World/releases/assets/1'
18+
)
1519
comment_url_for=helper.create_url_helper(
1620
'https://api.github.com/repos/octocat/Hello-World/comments/1'
1721
)
@@ -32,6 +36,9 @@
3236
'https://api.github.com/repos/octocat/Hello-World'
3337
)
3438

39+
get_asset_example_data=helper.create_example_data_helper(
40+
'asset_example'
41+
)
3542
get_repo_example_data=helper.create_example_data_helper(
3643
'repos_repo_example'
3744
)
@@ -53,6 +60,7 @@
5360
create_file_contents_example_data=helper.create_example_data_helper(
5461
'create_file_contents_example'
5562
)
63+
asset_example_data=get_asset_example_data()
5664
comment_example_data=get_comment_example_data()
5765
commit_example_data=get_commit_example_data()
5866
compare_example_data=get_compare_example_data()
@@ -1864,3 +1872,15 @@ def test_patch(self):
18641872
deftest_str(self):
18651873
"""Show that instance string is formatted correctly."""
18661874
assertstr(self.instance).startswith('<Comparison')
1875+
1876+
1877+
classTestAsset(helper.UnitHelper):
1878+
1879+
"""Unit test for Asset object."""
1880+
1881+
described_class=Asset
1882+
example_data=asset_example_data
1883+
1884+
deftest_str(self):
1885+
"""Show that instance string is formatted correctly."""
1886+
assertstr(self.instance).startswith('<Asset ')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp