Skip to content

Commit

Permalink
fix test mock with _list_bugs_unsubmitted
Browse files Browse the repository at this point in the history
    wasn't getting called now due to loss of happy path
  • Loading branch information
gamesguru committed Apr 19, 2024
1 parent 885ad74 commit 2765dc0
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions tests/services/test_bug.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ def test_bug_list_unsubmitted(self) -> None:
assert len(_bug.values()) >= 0
assert len(_bug.keys()) == 1

@patch("ntclient.services.api.cache_mirrors", return_value="https://someurl.com")
@patch(
"ntclient.services.api.ApiClient.post",
return_value=MagicMock(status_code=201),
)
@patch("ntclient.services.bugs.sql_nt", return_value=([], [], [], []))
# pylint: disable=unused-argument
def test_bug_report(self, *args: MagicMock) -> None:
"""Tests the functions for submitting bugs"""
result = bugs.submit_bugs()
assert isinstance(result, int)

@patch("ntclient.services.api.cache_mirrors", return_value="https://someurl.com")
@patch(
"ntclient.services.api.ApiClient.post",
Expand All @@ -52,9 +64,10 @@ def test_bug_list_unsubmitted(self) -> None:
@patch("ntclient.services.bugs._list_bugs_unsubmitted", return_value=[{"id": 1}])
@patch("ntclient.services.bugs.sql_nt")
# pylint: disable=unused-argument
def test_bug_report(self, *args: MagicMock) -> None:
def test_bug_report_with_unsubmitted(self, *args: MagicMock) -> None:
"""Tests the functions for submitting bugs"""
bugs.submit_bugs()
result = bugs.submit_bugs()
assert isinstance(result, int)

@patch("ntclient.services.api.cache_mirrors", return_value="https://someurl.com")
@patch(
Expand All @@ -66,7 +79,8 @@ def test_bug_report(self, *args: MagicMock) -> None:
# pylint: disable=unused-argument
def test_bug_report_on_204_status(self, *args: MagicMock) -> None:
"""Tests the functions for submitting bugs"""
bugs.submit_bugs()
result = bugs.submit_bugs()
assert result == 1

@patch("ntclient.services.api.cache_mirrors", return_value="https://someurl.com")
@patch(
Expand Down

0 comments on commit 2765dc0

Please sign in to comment.