Skip to content

Commit

Permalink
Update test_current.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tschm committed Mar 28, 2024
1 parent 3369e00 commit 11b3957
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/test_current.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ def test_current():


@patch("urllib.request.urlopen")
def test_cm(mock_urlopen):
def test_server(mock_urlopen):
# https://stackoverflow.com/questions/32043035/python-3-urlopen-context-manager- mocking

cm = MagicMock()
cm.read.return_value = b"maffay"
cm.__enter__.return_value = cm
mock_urlopen.return_value = cm
mock = MagicMock()
mock.read.return_value = b"maffay"
mock.__enter__.return_value = mock
mock_urlopen.return_value = mock

assert _url(server="http://localhost:8080/mosek") == "maffay"

Expand Down

0 comments on commit 11b3957

Please sign in to comment.