moving files around, pretty tables

This commit is contained in:
Tyrel Souza 2021-11-04 01:01:35 -04:00
parent 4b7a4d6b5a
commit 40c1baa893
14 changed files with 583 additions and 70 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
env/
Session.vim
Session.nvim
__pycache__/

27
api.py Normal file
View File

@ -0,0 +1,27 @@
import httpx
class API:
headers = {"Accept": "application/vnd.github.v3+json"}
def __init__(self, user_name: str) -> None:
self.user = self.load_user(user_name)
self.user_name = self.user["login"]
self.repos = self.load_repos() # TODO: Check if pagination
def _get(self, url: str) -> dict:
"""Uses httpx.Client().get to send the appropriate github headers, and return the url"""
with httpx.Client(headers=self.headers) as client:
return client.get(url).json()
def load_user(self, user_name: str) -> dict:
"""Sets the user object"""
return self._get(f"https://api.github.com/users/{user_name}")
def load_repo(self, repo_name: str) -> dict:
"""Set the repo object"""
return self._get(f"https://api.github.com/repos/{self.user_name}/{repo_name}")
def load_repos(self) -> dict:
"""Set the users repos"""
return self._get(f"https://api.github.com/users/{self.user_name}/repos")

28
api_tests.py Normal file
View File

@ -0,0 +1,28 @@
import json
import pytest
from api import API
from pytest_httpx import HTTPXMock
def _load_user():
with open("./tests/fixtures/user.json", "r") as f:
return json.loads(f.read())
def _load_repos():
with open("./tests/fixtures/repos.json", "r") as f:
return json.loads(f.read())
def test_load_user(httpx_mock: HTTPXMock):
httpx_mock.add_response(method="GET", json=_load_user())
gh = API(user_name="tyrelsouza")
assert gh.user["login"] == "tyrelsouza"
def test_load_repos(httpx_mock: HTTPXMock):
httpx_mock.add_response(method="GET", json=_load_user())
httpx_mock.add_response(method="GET", json=_load_repos())
gh = API(user_name="tyrelsouza")
assert gh.repos[0]["git_url"] == "git://github.com/tyrelsouza/genealogy.git"

50
cli.py
View File

@ -1,47 +1,17 @@
from ghub import GHub
from rich.prompt import Prompt
from rich import print
import httpx
from pprint import pprint
class GHub:
headers = {"Accept": "application/vnd.github.v3+json"}
def __init__(self, user_name: str, repo_name: str):
self.user_name = user_name
self.repo_name = repo_name
def get(self, url: str) -> dict:
"""Uses httpx.Client().get to send the appropriate github headers, and return the url"""
with httpx.Client(headers=self.headers) as client:
return client.get(url).json()
def schema(self) -> dict:
"""Show all the schema that are available"""
return self.get("https://api.github.com")
def set_user(self):
self.user = self.get_user()
def get_user(self) -> dict:
"""Get the user object"""
return self.get(f"https://api.github.com/users/{self.user_name}")
def set_repo(self):
self.repo = self.get_repo()
def get_repo(self) -> dict:
"""Get the repo object"""
return self.get(f"https://api.github.com/repos/{self.user_name}/{self.repo_name}")
def main():
gh = GHub(user_name="tyrelsouza", repo_name="work_sample")
# pprint(gh.schema())
pprint(
(
gh.get_user(),
gh.get_repo(),
)
)
user_name = Prompt.ask("Username?")
gh = GHub()
gh.load_user(user_name=user_name)
print(gh.repos_table())
if __name__ == "__main__":

41
ghub.py Normal file
View File

@ -0,0 +1,41 @@
from rich.table import Table
from rich.prompt import Prompt
from rich import print
from api import API
class GHub:
user = None
repos = None
def load_user(self, user_name: str) -> None:
self.user_name = user_name
self.api = API(self.user_name)
self.user = self.api.user
self.repos = self.api.repos
def repos_trimmed(self) -> list:
for repo in self.repos:
yield [
str(f)
for f in [
repo["name"],
repo["description"],
repo["stargazers_count"],
repo["watchers_count"],
repo["forks_count"],
repo["open_issues_count"],
]
]
def repos_table(self) -> Table:
table = Table(show_header=True, header_style="bold magenta")
table.add_column("Name")
table.add_column("Description")
table.add_column("Stargazers")
table.add_column("Watchers")
table.add_column("Forks")
table.add_column("Open Issues")
for repo in self.repos_trimmed():
table.add_row(*repo)
return table

22
ghub_tests.py Normal file
View File

@ -0,0 +1,22 @@
import json
import pytest
from ghub import GHub
def _load_user():
with open("./tests/fixtures/user.json", "r") as f:
return json.loads(f.read())
def _load_repos():
with open("./tests/fixtures/repos.json", "r") as f:
return json.loads(f.read())
def _fake_tyrel() -> GHub:
gh = GHub()
gh.user = _load_user()
gh.repos = _load_repos()
return gh
def test_load_repos():
gh = _fake_tyrel()
assert gh.repos[0]["git_url"] == "git://github.com/tyrelsouza/genealogy.git"

View File

@ -4,3 +4,4 @@ black
invoke
pytest
pytest-httpx
rich

View File

@ -18,6 +18,10 @@ click==8.0.3
# via
# black
# pip-tools
colorama==0.4.4
# via rich
commonmark==0.9.1
# via rich
h11==0.12.0
# via httpcore
httpcore==0.13.7
@ -50,6 +54,8 @@ pluggy==1.0.0
# via pytest
py==1.10.0
# via pytest
pygments==2.10.0
# via rich
pyparsing==2.4.7
# via packaging
pytest==6.2.5
@ -62,6 +68,8 @@ regex==2021.11.2
# via black
rfc3986[idna2008]==1.5.0
# via httpx
rich==10.12.0
# via -r requirements.in
sniffio==1.2.0
# via
# anyio

View File

@ -1,8 +1,16 @@
from invoke import task
from cli import main
@task
def run(c):
main()
@task
def test(c):
c.run("pytest tests.py --pdb")
c.run("pytest *_tests.py")
@task
def black(c):

View File

@ -1,29 +0,0 @@
import json
import pytest
from cli import GHub
from pytest_httpx import HTTPXMock
def _load_user():
with open("tests/user.json", "r") as f:
return json.loads(f.read())
def _load_repo():
with open("tests/repo.json", "r") as f:
return json.loads(f.read())
def test_user(httpx_mock: HTTPXMock):
httpx_mock.add_response(method="GET", json=_load_user())
gh = GHub(user_name="tyrelsouza", repo_name="work_sample")
gh.set_user()
assert(gh.user["login"] == "tyrelsouza")
def test_repo(httpx_mock: HTTPXMock):
httpx_mock.add_response(method="GET", json=_load_repo())
gh = GHub(user_name="tyrelsouza", repo_name="work_sample")
gh.set_repo()
breakpoint()
assert(gh.repo["login"] == "tyrelsouza2")

400
tests/fixtures/repos.json vendored Normal file
View File

@ -0,0 +1,400 @@
[
{
"id": 416199052,
"node_id": "R_kgDOGM6xjA",
"name": "genealogy",
"full_name": "tyrelsouza/genealogy",
"private": false,
"owner": {
"login": "tyrelsouza",
"id": 923113,
"node_id": "MDQ6VXNlcjkyMzExMw==",
"avatar_url": "https://avatars.githubusercontent.com/u/923113?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/tyrelsouza",
"html_url": "https://github.com/tyrelsouza",
"followers_url": "https://api.github.com/users/tyrelsouza/followers",
"following_url": "https://api.github.com/users/tyrelsouza/following{/other_user}",
"gists_url": "https://api.github.com/users/tyrelsouza/gists{/gist_id}",
"starred_url": "https://api.github.com/users/tyrelsouza/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/tyrelsouza/subscriptions",
"organizations_url": "https://api.github.com/users/tyrelsouza/orgs",
"repos_url": "https://api.github.com/users/tyrelsouza/repos",
"events_url": "https://api.github.com/users/tyrelsouza/events{/privacy}",
"received_events_url": "https://api.github.com/users/tyrelsouza/received_events",
"type": "User",
"site_admin": false
},
"html_url": "https://github.com/tyrelsouza/genealogy",
"description": null,
"fork": false,
"url": "https://api.github.com/repos/tyrelsouza/genealogy",
"forks_url": "https://api.github.com/repos/tyrelsouza/genealogy/forks",
"keys_url": "https://api.github.com/repos/tyrelsouza/genealogy/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/tyrelsouza/genealogy/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/tyrelsouza/genealogy/teams",
"hooks_url": "https://api.github.com/repos/tyrelsouza/genealogy/hooks",
"issue_events_url": "https://api.github.com/repos/tyrelsouza/genealogy/issues/events{/number}",
"events_url": "https://api.github.com/repos/tyrelsouza/genealogy/events",
"assignees_url": "https://api.github.com/repos/tyrelsouza/genealogy/assignees{/user}",
"branches_url": "https://api.github.com/repos/tyrelsouza/genealogy/branches{/branch}",
"tags_url": "https://api.github.com/repos/tyrelsouza/genealogy/tags",
"blobs_url": "https://api.github.com/repos/tyrelsouza/genealogy/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/tyrelsouza/genealogy/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/tyrelsouza/genealogy/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/tyrelsouza/genealogy/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/tyrelsouza/genealogy/statuses/{sha}",
"languages_url": "https://api.github.com/repos/tyrelsouza/genealogy/languages",
"stargazers_url": "https://api.github.com/repos/tyrelsouza/genealogy/stargazers",
"contributors_url": "https://api.github.com/repos/tyrelsouza/genealogy/contributors",
"subscribers_url": "https://api.github.com/repos/tyrelsouza/genealogy/subscribers",
"subscription_url": "https://api.github.com/repos/tyrelsouza/genealogy/subscription",
"commits_url": "https://api.github.com/repos/tyrelsouza/genealogy/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/tyrelsouza/genealogy/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/tyrelsouza/genealogy/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/tyrelsouza/genealogy/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/tyrelsouza/genealogy/contents/{+path}",
"compare_url": "https://api.github.com/repos/tyrelsouza/genealogy/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/tyrelsouza/genealogy/merges",
"archive_url": "https://api.github.com/repos/tyrelsouza/genealogy/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/tyrelsouza/genealogy/downloads",
"issues_url": "https://api.github.com/repos/tyrelsouza/genealogy/issues{/number}",
"pulls_url": "https://api.github.com/repos/tyrelsouza/genealogy/pulls{/number}",
"milestones_url": "https://api.github.com/repos/tyrelsouza/genealogy/milestones{/number}",
"notifications_url": "https://api.github.com/repos/tyrelsouza/genealogy/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/tyrelsouza/genealogy/labels{/name}",
"releases_url": "https://api.github.com/repos/tyrelsouza/genealogy/releases{/id}",
"deployments_url": "https://api.github.com/repos/tyrelsouza/genealogy/deployments",
"created_at": "2021-10-12T05:38:27Z",
"updated_at": "2021-10-12T05:38:32Z",
"pushed_at": "2021-10-12T05:38:29Z",
"git_url": "git://github.com/tyrelsouza/genealogy.git",
"ssh_url": "git@github.com:tyrelsouza/genealogy.git",
"clone_url": "https://github.com/tyrelsouza/genealogy.git",
"svn_url": "https://github.com/tyrelsouza/genealogy",
"homepage": null,
"size": 67,
"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,
"disabled": false,
"open_issues_count": 0,
"license": null,
"allow_forking": true,
"is_template": false,
"topics": [],
"visibility": "public",
"forks": 0,
"open_issues": 0,
"watchers": 0,
"default_branch": "master"
},
{
"id": 353575397,
"node_id": "MDEwOlJlcG9zaXRvcnkzNTM1NzUzOTc=",
"name": "proglog",
"full_name": "tyrelsouza/proglog",
"private": false,
"owner": {
"login": "tyrelsouza",
"id": 923113,
"node_id": "MDQ6VXNlcjkyMzExMw==",
"avatar_url": "https://avatars.githubusercontent.com/u/923113?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/tyrelsouza",
"html_url": "https://github.com/tyrelsouza",
"followers_url": "https://api.github.com/users/tyrelsouza/followers",
"following_url": "https://api.github.com/users/tyrelsouza/following{/other_user}",
"gists_url": "https://api.github.com/users/tyrelsouza/gists{/gist_id}",
"starred_url": "https://api.github.com/users/tyrelsouza/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/tyrelsouza/subscriptions",
"organizations_url": "https://api.github.com/users/tyrelsouza/orgs",
"repos_url": "https://api.github.com/users/tyrelsouza/repos",
"events_url": "https://api.github.com/users/tyrelsouza/events{/privacy}",
"received_events_url": "https://api.github.com/users/tyrelsouza/received_events",
"type": "User",
"site_admin": false
},
"html_url": "https://github.com/tyrelsouza/proglog",
"description": "Following Distributed Services with Go book",
"fork": false,
"url": "https://api.github.com/repos/tyrelsouza/proglog",
"forks_url": "https://api.github.com/repos/tyrelsouza/proglog/forks",
"keys_url": "https://api.github.com/repos/tyrelsouza/proglog/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/tyrelsouza/proglog/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/tyrelsouza/proglog/teams",
"hooks_url": "https://api.github.com/repos/tyrelsouza/proglog/hooks",
"issue_events_url": "https://api.github.com/repos/tyrelsouza/proglog/issues/events{/number}",
"events_url": "https://api.github.com/repos/tyrelsouza/proglog/events",
"assignees_url": "https://api.github.com/repos/tyrelsouza/proglog/assignees{/user}",
"branches_url": "https://api.github.com/repos/tyrelsouza/proglog/branches{/branch}",
"tags_url": "https://api.github.com/repos/tyrelsouza/proglog/tags",
"blobs_url": "https://api.github.com/repos/tyrelsouza/proglog/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/tyrelsouza/proglog/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/tyrelsouza/proglog/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/tyrelsouza/proglog/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/tyrelsouza/proglog/statuses/{sha}",
"languages_url": "https://api.github.com/repos/tyrelsouza/proglog/languages",
"stargazers_url": "https://api.github.com/repos/tyrelsouza/proglog/stargazers",
"contributors_url": "https://api.github.com/repos/tyrelsouza/proglog/contributors",
"subscribers_url": "https://api.github.com/repos/tyrelsouza/proglog/subscribers",
"subscription_url": "https://api.github.com/repos/tyrelsouza/proglog/subscription",
"commits_url": "https://api.github.com/repos/tyrelsouza/proglog/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/tyrelsouza/proglog/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/tyrelsouza/proglog/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/tyrelsouza/proglog/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/tyrelsouza/proglog/contents/{+path}",
"compare_url": "https://api.github.com/repos/tyrelsouza/proglog/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/tyrelsouza/proglog/merges",
"archive_url": "https://api.github.com/repos/tyrelsouza/proglog/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/tyrelsouza/proglog/downloads",
"issues_url": "https://api.github.com/repos/tyrelsouza/proglog/issues{/number}",
"pulls_url": "https://api.github.com/repos/tyrelsouza/proglog/pulls{/number}",
"milestones_url": "https://api.github.com/repos/tyrelsouza/proglog/milestones{/number}",
"notifications_url": "https://api.github.com/repos/tyrelsouza/proglog/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/tyrelsouza/proglog/labels{/name}",
"releases_url": "https://api.github.com/repos/tyrelsouza/proglog/releases{/id}",
"deployments_url": "https://api.github.com/repos/tyrelsouza/proglog/deployments",
"created_at": "2021-04-01T04:42:22Z",
"updated_at": "2021-04-10T04:17:56Z",
"pushed_at": "2021-04-10T04:17:54Z",
"git_url": "git://github.com/tyrelsouza/proglog.git",
"ssh_url": "git@github.com:tyrelsouza/proglog.git",
"clone_url": "https://github.com/tyrelsouza/proglog.git",
"svn_url": "https://github.com/tyrelsouza/proglog",
"homepage": null,
"size": 8,
"stargazers_count": 0,
"watchers_count": 0,
"language": "Go",
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"forks_count": 0,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 0,
"license": null,
"allow_forking": true,
"is_template": false,
"topics": [],
"visibility": "public",
"forks": 0,
"open_issues": 0,
"watchers": 0,
"default_branch": "main"
},
{
"id": 415131409,
"node_id": "R_kgDOGL5nEQ",
"name": "tyrel-intellij-demo",
"full_name": "tyrelsouza/tyrel-intellij-demo",
"private": false,
"owner": {
"login": "tyrelsouza",
"id": 923113,
"node_id": "MDQ6VXNlcjkyMzExMw==",
"avatar_url": "https://avatars.githubusercontent.com/u/923113?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/tyrelsouza",
"html_url": "https://github.com/tyrelsouza",
"followers_url": "https://api.github.com/users/tyrelsouza/followers",
"following_url": "https://api.github.com/users/tyrelsouza/following{/other_user}",
"gists_url": "https://api.github.com/users/tyrelsouza/gists{/gist_id}",
"starred_url": "https://api.github.com/users/tyrelsouza/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/tyrelsouza/subscriptions",
"organizations_url": "https://api.github.com/users/tyrelsouza/orgs",
"repos_url": "https://api.github.com/users/tyrelsouza/repos",
"events_url": "https://api.github.com/users/tyrelsouza/events{/privacy}",
"received_events_url": "https://api.github.com/users/tyrelsouza/received_events",
"type": "User",
"site_admin": false
},
"html_url": "https://github.com/tyrelsouza/tyrel-intellij-demo",
"description": null,
"fork": false,
"url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo",
"forks_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/forks",
"keys_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/teams",
"hooks_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/hooks",
"issue_events_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/issues/events{/number}",
"events_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/events",
"assignees_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/assignees{/user}",
"branches_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/branches{/branch}",
"tags_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/tags",
"blobs_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/statuses/{sha}",
"languages_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/languages",
"stargazers_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/stargazers",
"contributors_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/contributors",
"subscribers_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/subscribers",
"subscription_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/subscription",
"commits_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/contents/{+path}",
"compare_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/merges",
"archive_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/downloads",
"issues_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/issues{/number}",
"pulls_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/pulls{/number}",
"milestones_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/milestones{/number}",
"notifications_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/labels{/name}",
"releases_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/releases{/id}",
"deployments_url": "https://api.github.com/repos/tyrelsouza/tyrel-intellij-demo/deployments",
"created_at": "2021-10-08T21:28:08Z",
"updated_at": "2021-10-08T21:30:01Z",
"pushed_at": "2021-10-08T21:29:58Z",
"git_url": "git://github.com/tyrelsouza/tyrel-intellij-demo.git",
"ssh_url": "git@github.com:tyrelsouza/tyrel-intellij-demo.git",
"clone_url": "https://github.com/tyrelsouza/tyrel-intellij-demo.git",
"svn_url": "https://github.com/tyrelsouza/tyrel-intellij-demo",
"homepage": null,
"size": 104,
"stargazers_count": 0,
"watchers_count": 0,
"language": "Java",
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"forks_count": 0,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 0,
"license": null,
"allow_forking": true,
"is_template": false,
"topics": [],
"visibility": "public",
"forks": 0,
"open_issues": 0,
"watchers": 0,
"default_branch": "main"
},
{
"id": 228900091,
"node_id": "MDEwOlJlcG9zaXRvcnkyMjg5MDAwOTE=",
"name": "work_sample",
"full_name": "tyrelsouza/work_sample",
"private": false,
"owner": {
"login": "tyrelsouza",
"id": 923113,
"node_id": "MDQ6VXNlcjkyMzExMw==",
"avatar_url": "https://avatars.githubusercontent.com/u/923113?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/tyrelsouza",
"html_url": "https://github.com/tyrelsouza",
"followers_url": "https://api.github.com/users/tyrelsouza/followers",
"following_url": "https://api.github.com/users/tyrelsouza/following{/other_user}",
"gists_url": "https://api.github.com/users/tyrelsouza/gists{/gist_id}",
"starred_url": "https://api.github.com/users/tyrelsouza/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/tyrelsouza/subscriptions",
"organizations_url": "https://api.github.com/users/tyrelsouza/orgs",
"repos_url": "https://api.github.com/users/tyrelsouza/repos",
"events_url": "https://api.github.com/users/tyrelsouza/events{/privacy}",
"received_events_url": "https://api.github.com/users/tyrelsouza/received_events",
"type": "User",
"site_admin": false
},
"html_url": "https://github.com/tyrelsouza/work_sample",
"description": "i need a public repo for work.",
"fork": false,
"url": "https://api.github.com/repos/tyrelsouza/work_sample",
"forks_url": "https://api.github.com/repos/tyrelsouza/work_sample/forks",
"keys_url": "https://api.github.com/repos/tyrelsouza/work_sample/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/tyrelsouza/work_sample/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/tyrelsouza/work_sample/teams",
"hooks_url": "https://api.github.com/repos/tyrelsouza/work_sample/hooks",
"issue_events_url": "https://api.github.com/repos/tyrelsouza/work_sample/issues/events{/number}",
"events_url": "https://api.github.com/repos/tyrelsouza/work_sample/events",
"assignees_url": "https://api.github.com/repos/tyrelsouza/work_sample/assignees{/user}",
"branches_url": "https://api.github.com/repos/tyrelsouza/work_sample/branches{/branch}",
"tags_url": "https://api.github.com/repos/tyrelsouza/work_sample/tags",
"blobs_url": "https://api.github.com/repos/tyrelsouza/work_sample/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/tyrelsouza/work_sample/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/tyrelsouza/work_sample/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/tyrelsouza/work_sample/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/tyrelsouza/work_sample/statuses/{sha}",
"languages_url": "https://api.github.com/repos/tyrelsouza/work_sample/languages",
"stargazers_url": "https://api.github.com/repos/tyrelsouza/work_sample/stargazers",
"contributors_url": "https://api.github.com/repos/tyrelsouza/work_sample/contributors",
"subscribers_url": "https://api.github.com/repos/tyrelsouza/work_sample/subscribers",
"subscription_url": "https://api.github.com/repos/tyrelsouza/work_sample/subscription",
"commits_url": "https://api.github.com/repos/tyrelsouza/work_sample/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/tyrelsouza/work_sample/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/tyrelsouza/work_sample/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/tyrelsouza/work_sample/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/tyrelsouza/work_sample/contents/{+path}",
"compare_url": "https://api.github.com/repos/tyrelsouza/work_sample/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/tyrelsouza/work_sample/merges",
"archive_url": "https://api.github.com/repos/tyrelsouza/work_sample/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/tyrelsouza/work_sample/downloads",
"issues_url": "https://api.github.com/repos/tyrelsouza/work_sample/issues{/number}",
"pulls_url": "https://api.github.com/repos/tyrelsouza/work_sample/pulls{/number}",
"milestones_url": "https://api.github.com/repos/tyrelsouza/work_sample/milestones{/number}",
"notifications_url": "https://api.github.com/repos/tyrelsouza/work_sample/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/tyrelsouza/work_sample/labels{/name}",
"releases_url": "https://api.github.com/repos/tyrelsouza/work_sample/releases{/id}",
"deployments_url": "https://api.github.com/repos/tyrelsouza/work_sample/deployments",
"created_at": "2019-12-18T18:36:33Z",
"updated_at": "2019-12-18T18:37:38Z",
"pushed_at": "2019-12-18T18:37:36Z",
"git_url": "git://github.com/tyrelsouza/work_sample.git",
"ssh_url": "git@github.com:tyrelsouza/work_sample.git",
"clone_url": "https://github.com/tyrelsouza/work_sample.git",
"svn_url": "https://github.com/tyrelsouza/work_sample",
"homepage": null,
"size": 3,
"stargazers_count": 0,
"watchers_count": 0,
"language": "Python",
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"forks_count": 0,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 1,
"license": {
"key": "mit",
"name": "MIT License",
"spdx_id": "MIT",
"url": "https://api.github.com/licenses/mit",
"node_id": "MDc6TGljZW5zZTEz"
},
"allow_forking": true,
"is_template": false,
"topics": [],
"visibility": "public",
"forks": 0,
"open_issues": 1,
"watchers": 0,
"default_branch": "master"
}
]

35
tests/fixtures/schema.json vendored Normal file
View File

@ -0,0 +1,35 @@
{
"current_user_url": "https://api.github.com/user",
"current_user_authorizations_html_url": "https://github.com/settings/connections/applications{/client_id}",
"authorizations_url": "https://api.github.com/authorizations",
"code_search_url": "https://api.github.com/search/code?q={query}{&page,per_page,sort,order}",
"commit_search_url": "https://api.github.com/search/commits?q={query}{&page,per_page,sort,order}",
"emails_url": "https://api.github.com/user/emails",
"emojis_url": "https://api.github.com/emojis",
"events_url": "https://api.github.com/events",
"feeds_url": "https://api.github.com/feeds",
"followers_url": "https://api.github.com/user/followers",
"following_url": "https://api.github.com/user/following{/target}",
"gists_url": "https://api.github.com/gists{/gist_id}",
"hub_url": "https://api.github.com/hub",
"issue_search_url": "https://api.github.com/search/issues?q={query}{&page,per_page,sort,order}",
"issues_url": "https://api.github.com/issues",
"keys_url": "https://api.github.com/user/keys",
"label_search_url": "https://api.github.com/search/labels?q={query}&repository_id={repository_id}{&page,per_page}",
"notifications_url": "https://api.github.com/notifications",
"organization_url": "https://api.github.com/orgs/{org}",
"organization_repositories_url": "https://api.github.com/orgs/{org}/repos{?type,page,per_page,sort}",
"organization_teams_url": "https://api.github.com/orgs/{org}/teams",
"public_gists_url": "https://api.github.com/gists/public",
"rate_limit_url": "https://api.github.com/rate_limit",
"repository_url": "https://api.github.com/repos/{owner}/{repo}",
"repository_search_url": "https://api.github.com/search/repositories?q={query}{&page,per_page,sort,order}",
"current_user_repositories_url": "https://api.github.com/user/repos{?type,page,per_page,sort}",
"starred_url": "https://api.github.com/user/starred{/owner}{/repo}",
"starred_gists_url": "https://api.github.com/gists/starred",
"topic_search_url": "https://api.github.com/search/topics?q={query}{&page,per_page}",
"user_url": "https://api.github.com/users/{user}",
"user_organizations_url": "https://api.github.com/user/orgs",
"user_repositories_url": "https://api.github.com/users/{user}/repos{?type,page,per_page,sort}",
"user_search_url": "https://api.github.com/search/users?q={query}{&page,per_page,sort,order}"
}