Skip to content

Commit

Permalink
Use mock patch instead of ghetto monkey patch
Browse files Browse the repository at this point in the history
  • Loading branch information
hellais committed Apr 23, 2024
1 parent 405017a commit d5a0117
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions api/tests/unit/test_probe_services.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from unittest.mock import MagicMock, Mock
from unittest.mock import patch

import ooniapi.probe_services
from ooniapi.probe_services import random_web_test_helpers, round_robin_web_test_helpers


def test_web_test_helpers():
ooniapi.probe_services.extract_probe_ipaddr = Mock(return_value="1.2.3.4")
@patch("ooniapi.probe_services.extract_probe_ipaddr")
def test_web_test_helpers(mock):
mock.return_value = "1.2.3.4"
r1 = random_web_test_helpers(
[
"https://0.th.ooni.org",
Expand Down

0 comments on commit d5a0117

Please sign in to comment.