Skip to content

Commit

Permalink
Remove unused test module and add small check for eic
Browse files Browse the repository at this point in the history
  • Loading branch information
lwasser committed Nov 22, 2024
1 parent 1e187f7 commit e65fe59
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 39 deletions.
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

@pytest.fixture
def ghuser_response():
"""This is the initial github response. I changed the username to
"""This is the initial GitHub response. I changed the username to
create this object"""
expected_response = {
"login": "chayadecacao",
Expand Down
59 changes: 33 additions & 26 deletions tests/integration/test_review_model.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,43 @@
import pytest

from pyosmeta.models import ReviewModel


# We could setup some example data using fixtures and a conf.py
# Once we have a better view of the test suite.
example = {
"submitting_author": {
"github_username": "nabobalis",
"name": "Nabil Freij",
},
"all_current_maintainers": [],
"package_name": "sunpy",
"one-line_description_of_package": "Python for Solar Physics",
"repository_link": "https://github.com/sunpy/sunpy",
"version_submitted": "5.0.1",
"editor": {"github_username": "cmarmo", "name": ""},
"reviewer_1": {"github_username": "Septaris", "name": ""},
"reviewer_2": {"github_username": "nutjob4life", "name": ""},
"archive": "[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.8384174.svg)](https://doi.org/10.5281/zenodo.8384174)",
"version_accepted": "5.1.1",
"joss_doi": "[![DOI](https://joss.theoj.org/papers/10.21105/joss.01832/status.svg)](https://joss.theoj.org/papers/10.21105/joss.01832)",
"date_accepted": "01/18/2024",
"categories": [
"data-retrieval",
"data-extraction",
"data-processing/munging",
"data-visualization",
],
}
@pytest.fixture
def review_data():
return {
"submitting_author": {
"github_username": "nabobalis",
"name": "Nabil Freij",
},
"all_current_maintainers": [],
"package_name": "sunpy",
"one-line_description_of_package": "Python for Solar Physics",
"repository_link": "https://github.com/sunpy/sunpy",
"version_submitted": "5.0.1",
"eic": {"github_username": "cmarmo", "name": ""},
"editor": {"github_username": "cmarmo", "name": ""},
"reviewer_1": {"github_username": "Septaris", "name": ""},
"reviewer_2": {"github_username": "nutjob4life", "name": ""},
"archive": "[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.8384174.svg)](https://doi.org/10.5281/zenodo.8384174)",
"version_accepted": "5.1.1",
"joss_doi": "[![DOI](https://joss.theoj.org/papers/10.21105/joss.01832/status.svg)](https://joss.theoj.org/papers/10.21105/joss.01832)",
"date_accepted": "01/18/2024",
"categories": [
"data-retrieval",
"data-extraction",
"data-processing/munging",
"data-visualization",
],
}


def test_alias_choices_validation():
def test_alias_choices_validation(review_data):
"""Test that model correctly recognizes the field alias"""

new = ReviewModel(**example)
new = ReviewModel(**review_data)
assert new.date_accepted == "2024-01-18"
assert new.package_description == "Python for Solar Physics"
assert new.eic.github_username == "cmarmo"
6 changes: 3 additions & 3 deletions tests/unit/test_github_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,21 @@ def test_api_endpoint_with_invalid_dates(after_date, expected_url):
def test_get_user_info_successful(mocker, ghuser_response):
"""Test that an expected response returns properly"""

expected_response = ghuser_response
mock_response = mocker.Mock()
mock_response.status_code = 200
mock_response.json.return_value = expected_response
mock_response.json.return_value = ghuser_response
mocker.patch("requests.get", return_value=mock_response)

github_api_instance = GitHubAPI()
user_info = github_api_instance.get_user_info("example_user")

assert user_info == expected_response
assert user_info == ghuser_response


def test_get_user_info_bad_credentials(mocker):
"""Test that a value error is raised when the GH token is not
valid."""

mock_response = mocker.Mock()
mock_response.status_code = 401
mocker.patch("requests.get", return_value=mock_response)
Expand Down
9 changes: 0 additions & 9 deletions tests/unit/test_update_review_teams.py

This file was deleted.

0 comments on commit e65fe59

Please sign in to comment.