diff --git a/tests/conftest.py b/tests/conftest.py index 1d6c304..4a8f2ac 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -4,6 +4,13 @@ from pyosmeta.parse_issues import ProcessIssues +@pytest.fixture +def github_api(): + return GitHubAPI( + org="pyopensci", repo="pyosmeta", labels=["label1", "label2"] + ) + + @pytest.fixture def process_issues(): """A fixture that returns an instance of the ProcessIssues class""" diff --git a/tests/unit/test_github_api.py b/tests/unit/test_github_api.py index 65757bd..2e17e99 100644 --- a/tests/unit/test_github_api.py +++ b/tests/unit/test_github_api.py @@ -40,3 +40,14 @@ def test_missing_token(mock_missing_github_token, tmpdir): with pytest.raises(KeyError, match="Oops! A GITHUB_TOKEN environment"): github_api.get_token() + + +def test_api_endpoint(github_api): + """Test that the generated api url created in the property + is as expected + """ + expected_endpoint = ( + "https://api.github.com/repos/pyopensci/pyosmeta/" + "issues?labels=label1,label2&state=all&per_page=100" + ) + assert github_api.api_endpoint == expected_endpoint