Skip to content

Commit

Permalink
Remove staff review (#28)
Browse files Browse the repository at this point in the history
* Removed has_staff_review

* Increment version

* Fix Tox tests

* Forgot to rename these variables

* Add tests to check for no staff review fields
  • Loading branch information
Buried-In-Code authored Sep 8, 2021
1 parent 4769ae4 commit c6e7b36
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 66 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Testing'
name: 'Tox Testing'

on:
push:
Expand All @@ -22,7 +22,7 @@ jobs:
- macos-latest
- windows-latest
env:
COMICVINE: ${{ secrets.COMICVINE_KEY }}
COMICVINE_API_KEY: ${{ secrets.COMICVINE_API_KEY }}
runs-on: ${{ matrix.os }}
steps:
#----------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

[![Github - Contributors](https://img.shields.io/github/contributors/Buried-In-Code/Simyan.svg?logo=Github&label=Contributors&style=flat-square)](https://github.com/Buried-In-Code/Simyan/graphs/contributors)
[![Github Action - Code Analysis](https://img.shields.io/github/workflow/status/Buried-In-Code/Simyan/Code-Analysis?logo=Github-Actions&label=Code-Analysis&style=flat-square)](https://github.com/Buried-In-Code/Simyan/actions/workflows/code-analysis.yaml)
[![Github Action - Testing](https://img.shields.io/github/workflow/status/Buried-In-Code/Simyan/Testing?logo=Github-Actions&label=Tests&style=flat-square)](https://github.com/Buried-In-Code/Simyan/actions/workflows/testing.yaml)
[![Github Action - Tox Testing](https://img.shields.io/github/workflow/status/Buried-In-Code/Simyan/Tox-Testing?logo=Github-Actions&label=Tox-Tests&style=flat-square)](https://github.com/Buried-In-Code/Simyan/actions/workflows/tox-testing.yaml)

[![Code Style - Black](https://img.shields.io/badge/Code%20Style-Black-000000.svg?style=flat-square)](https://github.com/psf/black)

Expand Down
2 changes: 1 addition & 1 deletion Simyan/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class IssueSchema(Schema):
GenericEntrySchema, data_key="first_appearance_storyarcs", allow_none=True
)
first_appearance_teams = fields.Nested(GenericEntrySchema, allow_none=True)
has_staff_review = fields.Bool()
# Ignoring has_staff_review
id = fields.Int()
image = fields.Nested(ImageEntrySchema)
locations = fields.Nested(GenericEntrySchema, data_key="location_credits", many=True)
Expand Down
2 changes: 1 addition & 1 deletion Simyan/issue_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class IssueResultSchema(Schema):
date_added = fields.DateTime(format="%Y-%m-%d %H:%M:%S")
date_last_updated = fields.DateTime(format="%Y-%m-%d %H:%M:%S")
description = fields.Str()
has_staff_review = fields.Bool()
# Ignoring has_staff_review
id = fields.Int()
image = fields.Nested(ImageEntrySchema)
name = fields.Str(allow_none=True)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "Simyan"
version = "0.4.2"
version = "0.4.3"
description = "A Python wrapper for the Comicvine API."
license = "MIT"
authors = ["Buried-In-Code <6057651+Buried-In-Code@users.noreply.github.com>"]
Expand Down
Binary file modified tests/Simyan-Cache.sqlite
Binary file not shown.
12 changes: 4 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@


@pytest.fixture(scope="session")
def api_key():
return os.getenv("COMICVINE", "INVALID")
def comicvine_api_key():
return os.getenv("COMICVINE_API_KEY", "INVALID")


@pytest.fixture(scope="session")
def talker(api_key):
print(api_key)
return api(
api_key=api_key,
cache=sqlite_cache.SqliteCache("tests/Simyan-Cache.sqlite"),
)
def comicvine(comicvine_api_key):
return api(api_key=comicvine_api_key, cache=sqlite_cache.SqliteCache("tests/Simyan-Cache.sqlite"))
16 changes: 8 additions & 8 deletions tests/test_creators.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
WEBSITE = None


def test_creator(talker):
result = talker.creator(ID)
def test_creator(comicvine):
result = comicvine.creator(ID)
assert result.country == COUNTRY
assert result.date_of_birth == DATE_OF_BIRTH
assert result.date_of_death == DATE_OF_DEATH
Expand All @@ -40,13 +40,13 @@ def test_creator(talker):
assert result.website == WEBSITE


def test_creator_fail(talker):
def test_creator_fail(comicvine):
with pytest.raises(APIError):
talker.creator(-1)
comicvine.creator(-1)


def test_creator_list(talker):
search_results = talker.creator_list({"filter": f"name:{NAME}"})
def test_creator_list(comicvine):
search_results = comicvine.creator_list({"filter": f"name:{NAME}"})
result = [x for x in search_results if x.id == ID][0]
assert result.country == COUNTRY
assert result.date_of_birth == DATE_OF_BIRTH
Expand All @@ -60,6 +60,6 @@ def test_creator_list(talker):
assert result.website == WEBSITE


def test_creator_list_empty(talker):
results = talker.creator_list({"filter": "name:INVALID"})
def test_creator_list_empty(comicvine):
results = comicvine.creator_list({"filter": "name:INVALID"})
assert len(results) == 0
48 changes: 29 additions & 19 deletions tests/test_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
VOLUME_NAME = "Green Lantern"


def test_issue(talker):
result = talker.issue(ID)
def test_issue(comicvine):
result = comicvine.issue(ID)
assert result.cover_date == COVER_DATE
assert result.first_appearance_story_arcs == FIRST_APPEARANCE_STORY_ARCS
assert result.id == ID
Expand All @@ -36,13 +36,26 @@ def test_issue(talker):
assert result.volume.name == VOLUME_NAME


def test_issue_fail(talker):
def test_issue_fail(comicvine):
with pytest.raises(APIError):
talker.issue(-1)
comicvine.issue(-1)


def test_issue_list(talker):
search_results = talker.issue_list({"filter": f"volume:{VOLUME_ID},issue_number:{NUMBER}"})
def test_issue_bad_cover_date(comicvine):
xmen_2 = comicvine.issue(6787)
assert xmen_2.store_date is None
assert xmen_2.cover_date == date(1963, 11, 1)
assert xmen_2.id == 6787
assert xmen_2.number == "2"
assert len(xmen_2.creators) == 4
assert xmen_2.creators[0].name == "Jack Kirby"
assert xmen_2.creators[0].roles == "penciler"
assert len(xmen_2.characters) == 10
assert xmen_2.characters[0].name == "Angel"


def test_issue_list(comicvine):
search_results = comicvine.issue_list({"filter": f"volume:{VOLUME_ID},issue_number:{NUMBER}"})
result = [x for x in search_results if x.id == ID][0]
assert result.cover_date == COVER_DATE
assert result.id == ID
Expand All @@ -53,19 +66,16 @@ def test_issue_list(talker):
assert result.volume.name == VOLUME_NAME


def test_issue_list_empty(talker):
results = talker.issue_list({"filter": "name:INVALID"})
def test_issue_list_empty(comicvine):
results = comicvine.issue_list({"filter": "name:INVALID"})
assert len(results) == 0


def test_issue_bad_cover_date(talker):
xmen_2 = talker.issue(6787)
assert xmen_2.store_date is None
assert xmen_2.cover_date == date(1963, 11, 1)
assert xmen_2.id == 6787
assert xmen_2.number == "2"
assert len(xmen_2.creators) == 4
assert xmen_2.creators[0].name == "Jack Kirby"
assert xmen_2.creators[0].roles == "penciler"
assert len(xmen_2.characters) == 10
assert xmen_2.characters[0].name == "Angel"
def test_issue_no_has_staff_review(comicvine):
result = comicvine.issue(505513)
assert "has_staff_review" not in result.__dict__.keys()


def test_issue_list_no_has_staff_review(comicvine):
result = comicvine.issue_list({"filter": "issue_number:1,volume:85930"})
assert "has_staff_review" not in result.__dict__.keys()
16 changes: 8 additions & 8 deletions tests/test_publishers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
VOLUME_NAME = "Movie Comics"


def test_publisher(talker):
result = talker.publisher(ID)
def test_publisher(comicvine):
result = comicvine.publisher(ID)
assert result.id == ID
assert result.location_address == LOCATION_ADDRESS
assert result.location_city == LOCATION_CITY
Expand All @@ -26,13 +26,13 @@ def test_publisher(talker):
assert result.volumes[0].name == VOLUME_NAME


def test_publisher_fail(talker):
def test_publisher_fail(comicvine):
with pytest.raises(APIError):
talker.publisher(-1)
comicvine.publisher(-1)


def test_publisher_list(talker):
search_results = talker.publisher_list({"filter": f"name:{NAME}"})
def test_publisher_list(comicvine):
search_results = comicvine.publisher_list({"filter": f"name:{NAME}"})
result = [x for x in search_results if x.id == ID][0]
assert result.id == ID
assert result.location_address == LOCATION_ADDRESS
Expand All @@ -41,6 +41,6 @@ def test_publisher_list(talker):
assert result.name == NAME


def test_publisher_list_empty(talker):
results = talker.publisher_list({"filter": "name:INVALID"})
def test_publisher_list_empty(comicvine):
results = comicvine.publisher_list({"filter": "name:INVALID"})
assert len(results) == 0
16 changes: 8 additions & 8 deletions tests/test_story_arcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
PUBLISHER_NAME = "DC Comics"


def test_story_arc(talker):
result = talker.story_arc(ID)
def test_story_arc(comicvine):
result = comicvine.story_arc(ID)
assert result.first_issue.id == FIRST_ISSUE_ID
assert result.first_issue.name == FIRST_ISSUE_NAME
assert result.first_issue.number == FIRST_ISSUE_NUMBER
Expand All @@ -28,13 +28,13 @@ def test_story_arc(talker):
assert result.publisher.name == PUBLISHER_NAME


def test_story_arc_fail(talker):
def test_story_arc_fail(comicvine):
with pytest.raises(APIError):
talker.story_arc(-1)
comicvine.story_arc(-1)


def test_story_arc_list(talker):
search_results = talker.story_arc_list({"filter": f"name:{NAME}"})
def test_story_arc_list(comicvine):
search_results = comicvine.story_arc_list({"filter": f"name:{NAME}"})
result = [x for x in search_results if x.id == ID][0]
assert result.first_issue.id == FIRST_ISSUE_ID
assert result.first_issue.name == FIRST_ISSUE_NAME
Expand All @@ -46,6 +46,6 @@ def test_story_arc_list(talker):
assert result.publisher.name == PUBLISHER_NAME


def test_story_arc_list_empty(talker):
results = talker.story_arc_list({"filter": "name:INVALID"})
def test_story_arc_list_empty(comicvine):
results = comicvine.story_arc_list({"filter": "name:INVALID"})
assert len(results) == 0
16 changes: 8 additions & 8 deletions tests/test_volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
START_YEAR = "2005"


def test_volume(talker):
result = talker.volume(ID)
def test_volume(comicvine):
result = comicvine.volume(ID)
assert result.creators[0].id == CREATOR_ID
assert result.creators[0].name == CREATOR_NAME
assert result.creators[0].count == CREATOR_COUNT
Expand All @@ -44,13 +44,13 @@ def test_volume(talker):
assert result.start_year == START_YEAR


def test_volume_fail(talker):
def test_volume_fail(comicvine):
with pytest.raises(APIError):
talker.volume(-1)
comicvine.volume(-1)


def test_volume_list(talker):
search_results = talker.volume_list({"filter": f"name:{NAME}"})
def test_volume_list(comicvine):
search_results = comicvine.volume_list({"filter": f"name:{NAME}"})
result = [x for x in search_results if x.id == ID][0]
assert result.first_issue.id == FIRST_ISSUE_ID
assert result.first_issue.name == FIRST_ISSUE_NAME
Expand All @@ -66,6 +66,6 @@ def test_volume_list(talker):
assert result.start_year == START_YEAR


def test_volume_list_empty(talker):
results = talker.volume_list({"filter": "name:INVALID"})
def test_volume_list_empty(comicvine):
results = comicvine.volume_list({"filter": "name:INVALID"})
assert len(results) == 0
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ envlist = py37, py38, py39

[testenv]
setenv =
COMICVINE={env:COMICVINE}
COMICVINE_API_KEY={env:COMICVINE_API_KEY}
deps = pytest
commands =
python --version
Expand Down

0 comments on commit c6e7b36

Please sign in to comment.