8000 Extract example data from json instead of having it in the file · pljensen/github3.py@d3f4408 · GitHub
[go: up one dir, main page]

Skip to content

Commit d3f4408

Browse files
christophelecsigmavirus24
authored andcommitted
Extract example data from json instead of having it in the file
1 parent 96c7365 commit d3f4408

File tree

1 file changed

+6
-38
lines changed

1 file changed

+6
-38
lines changed

tests/unit/test_github_enterprise.py

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,11 @@
11
from github3.github import GitHubEnterprise
22
import github3
33

4-
from .helper import UnitHelper
5-
6-
example_data = {
7-
"login": "octocat",
8-
"id": 1,
9-
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
10-
"gravatar_id": "somehexcode",
11-
"url": "https://api.github.com/users/octocat",
12-
"html_url": "https://github.com/octocat",
13-
"followers_url": "https://api.github.com/users/octocat/followers",
14-
"following_url": ("https://api.github.com/users/octocat/following"
15-
"{/other_user}"),
16-
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
17-
"starred_url": ("https://api.github.com/users/octocat/starred"
18-
"{/owner}{/repo}"),
19-
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
20-
"organizations_url": "https://api.github.com/users/octocat/orgs",
21-
"repos_url": "https://api.github.com/users/octocat/repos",
22-
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
23-
"received_events_url": ("https://api.github.com/users/octocat/"
24-
"received_events"),
25-
"type": "User",
26-
"site_admin": False,
27-
"name": "monalisa octocat",
28-
"company": "GitHub",
29-
"blog": "https://github.com/blog",
30-
"location": "San Francisco",
31-
"email": "octocat@github.com",
32-
"hireable": False,
33-
"bio": "There once was...",
34-
"public_repos": 2,
35-
"public_gists": 1,
36-
"followers": 20,
37-
"following": 0,
38-
"created_at": "2008-01-14T04:33:35Z",
39-
"updated_at": "2008-01-14T04:33:35Z"
40-
}
4+
from .helper import UnitHelper, create_example_data_helper
5+
6+
get_example_user = create_example_data_helper('user_example')
7+
8+
example_data = get_example_user()
419

4210
base_url = 'https://ghe.example.com/'
4311

@@ -76,7 +44,7 @@ def test_create_user(self):
7644

7745
class TestUserAdministration(UnitHelper):
7846
described_class = github3.users.User
79-
example_data = example_data.copy()
47+
example_data = example_data
8048
# Remove the end of the string starting with 'users'
8149
base_url = example_data['url'][:example_data['url'].rfind('users')]
8250

0 commit comments

Comments
 (0)
0