Skip to content

Commit

Permalink
Fix GetModerationRuns regression
Browse files Browse the repository at this point in the history
  • Loading branch information
ManicJamie committed May 1, 2024
1 parent c573086 commit bb57e88
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 7 additions & 3 deletions src/speedruncompy/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,12 +546,16 @@ class GetModerationRuns(PostRequest[r_GetModerationRuns], BasePaginatedRequest[r
### Mandatory:
- @gameId
- @limit: # TODO: range
- @page
### Optional:
- @limit:
- @search
- @verified: `Verified`
- @verifiedById
"""
def __init__(self, gameId: str, **params) -> None:
super().__init__("GetModerationRuns", returns=r_GetModerationRuns, gameId=gameId, **params)
def __init__(self, gameId: str, limit: int, page: int = 1, **params) -> None:
super().__init__("GetModerationRuns", returns=r_GetModerationRuns, gameId=gameId, limit=limit, page=page, **params)

def _combine_results(self, pages: dict):
# TODO: is this all really necessary?
Expand Down
8 changes: 4 additions & 4 deletions test/test_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,23 +462,23 @@ def test_GetModerationGames_unauthed(self):
assert result.games is None

def test_GetModerationRuns(self):
result = GetModerationRuns(_api=self.api, gameId=game_id).perform()
result = GetModerationRuns(_api=self.api, gameId=game_id, limit=20, page=1).perform()
log_result(result)
check_datatype_coverage(result)

def test_GetModerationRuns_paginated(self):
result = GetModerationRuns(_api=self.api, gameId=game_id, verified=Verified.PENDING).perform_all()
result = GetModerationRuns(_api=self.api, gameId=game_id, limit=20, page=1, verified=Verified.PENDING).perform_all()
log_result(result)
check_datatype_coverage(result)

def test_GetModerationRuns_paginated_raw(self):
result = GetModerationRuns(_api=self.api, gameId=game_id, verified=Verified.PENDING)._perform_all_raw()
result = GetModerationRuns(_api=self.api, gameId=game_id, limit=20, page=1, verified=Verified.PENDING)._perform_all_raw()
log_result(result)
check_pages(result)

def test_GetModerationRuns_unauthed(self):
with pytest.raises(Unauthorized):
GetModerationRuns(gameId=game_id, verified=Verified.PENDING).perform()
GetModerationRuns(gameId=game_id, limit=20, page=1, verified=Verified.PENDING).perform()

def test_GetNotifications(self):
result = GetNotifications(_api=self.api).perform()
Expand Down

0 comments on commit bb57e88

Please sign in to comment.