ghub/ghub_tests.py

26 lines
518 B
Python
Raw Normal View History

2021-11-04 05:01:35 +00:00
import json
import pytest
from ghub import GHub
2021-11-05 02:59:03 +00:00
2021-11-04 05:01:35 +00:00
def _load_user():
with open("./tests/fixtures/user.json", "r") as f:
return json.loads(f.read())
2021-11-05 02:59:03 +00:00
2021-11-04 05:01:35 +00:00
def _load_repos():
2021-11-05 02:59:03 +00:00
with open("./tests/fixtures/repos_1.json", "r") as f:
2021-11-04 05:01:35 +00:00
return json.loads(f.read())
2021-11-05 02:59:03 +00:00
2021-11-04 05:01:35 +00:00
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"