Skip to content

Commit

Permalink
fix(change): promoted path parms is required for listing (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryshu authored Oct 4, 2023
1 parent 7616dde commit 40d4dac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions novu/api/change.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,20 @@ def __init__(

self._change_url = f"{self._url}{CHANGES_ENDPOINT}"

def list(self, page: Optional[int] = None, limit: Optional[int] = None) -> PaginatedChangeDto:
def list(
self, page: Optional[int] = None, limit: Optional[int] = None, promoted: str = "false"
) -> PaginatedChangeDto:
"""List existing changes
Args:
page: Page to retrieve. Defaults to None.
limit: Size of the page to retrieve. Defaults to None.
promoted: Required string to retrieve changes.
Returns:
Paginated list of change
"""
payload: Dict[str, Union[int, str]] = {}
payload: Dict[str, Union[int, str]] = {"promoted": promoted}
if page:
payload["page"] = page
if limit:
Expand Down
4 changes: 2 additions & 2 deletions tests/api/test_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ def test_list(self, mock_request: mock.MagicMock) -> None:
url="sample.novu.com/v1/changes",
headers={"Authorization": "ApiKey api-key"},
json=None,
params={},
params={"promoted": "false"},
timeout=5,
)

Expand All @@ -611,7 +611,7 @@ def test_list_with_pagination(self, mock_request: mock.MagicMock) -> None:
url="sample.novu.com/v1/changes",
headers={"Authorization": "ApiKey api-key"},
json=None,
params={"page": 1, "limit": 10},
params={"page": 1, "limit": 10, "promoted": "false"},
timeout=5,
)

Expand Down

0 comments on commit 40d4dac

Please sign in to comment.