Skip to content

Commit

Permalink
Update tests for peer devices with reserved network locations
Browse files Browse the repository at this point in the history
  • Loading branch information
LianaHarris360 committed Nov 26, 2024
1 parent 862ef65 commit 6217708
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion kolibri/core/content/test/utils/test_content_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from kolibri.core.discovery.models import ConnectionStatus
from kolibri.core.discovery.models import NetworkLocation
from kolibri.core.discovery.utils.network.errors import NetworkError
from kolibri.core.discovery.well_known import CENTRAL_CONTENT_BASE_INSTANCE_ID


_module = "kolibri.core.content.utils.content_request."
Expand Down Expand Up @@ -589,12 +590,21 @@ def test_no_peers__connection_status(self):
instance = PreferredDevices([netloc.instance_id])
self.assertEqual(len(list(instance)), 0)

def test_one_peer__reserved__connection_status(self):
def test_no_peer__reserved__connection_status(self):
netloc = self._create_network_location(
location_type="reserved",
connection_status=ConnectionStatus.ConnectionFailure,
)
instance = PreferredDevices([netloc.instance_id])
self.assertEqual(len(list(instance)), 0)

def test__peer__studio__reserved__connection_status(self):
netloc = self._create_network_location(
location_type="reserved",
connection_status=ConnectionStatus.ConnectionFailure,
instance_id=CENTRAL_CONTENT_BASE_INSTANCE_ID,
)
instance = PreferredDevices([netloc.instance_id])
peers = list(instance)
self.assertEqual(len(peers), 1)
self.assertEqual(peers[0].instance_id, netloc.instance_id)
Expand Down

0 comments on commit 6217708

Please sign in to comment.