Skip to content

Commit

Permalink
Merge pull request #12549 from rtibbles/why_dont_you_mock_me_oh_lord
Browse files Browse the repository at this point in the history
Revert use of network client in test utils.
  • Loading branch information
rtibbles authored Aug 8, 2024
2 parents 9dcb652 + cee9ecd commit 83edcef
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions kolibri/core/auth/test/sync_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
import time
import uuid

import requests
from django.conf import settings
from django.db import connection
from django.db import connections
from django.utils.functional import wraps
from morango.models.core import DatabaseIDModel
from requests.exceptions import RequestException

from kolibri.core.auth.models import Facility
from kolibri.core.auth.models import FacilityUser
from kolibri.core.discovery.utils.network.client import NetworkClient
from kolibri.core.discovery.utils.network.errors import NetworkLocationResponseFailure

# custom Morango instance info used in tests
CUSTOM_INSTANCE_INFO = {"kolibri": "0.14.7"}
Expand Down Expand Up @@ -119,13 +119,12 @@ def pipe_shell(self, text):
)

def _wait_for_server_start(self, timeout=20):
client = NetworkClient.build_for_address(self.baseurl, timeout=3)
for i in range(timeout * 2):
try:
resp = client.get("api/public/info/")
resp = requests.get(self.baseurl + "api/public/info/", timeout=3)
if resp.status_code > 0:
return
except NetworkLocationResponseFailure:
except RequestException:
pass
time.sleep(0.5)

Expand Down

0 comments on commit 83edcef

Please sign in to comment.