From 621770837320e87a1e725913de0c1f655a31850f Mon Sep 17 00:00:00 2001 From: Liana Harris <46411498+LianaHarris360@users.noreply.github.com> Date: Tue, 26 Nov 2024 10:55:47 -0600 Subject: [PATCH] Update tests for peer devices with reserved network locations --- .../core/content/test/utils/test_content_request.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/kolibri/core/content/test/utils/test_content_request.py b/kolibri/core/content/test/utils/test_content_request.py index b787e40b0bc..8efefe7bd1f 100644 --- a/kolibri/core/content/test/utils/test_content_request.py +++ b/kolibri/core/content/test/utils/test_content_request.py @@ -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." @@ -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)