@@ -371,45 +371,6 @@ async def test_dns_service_get_public_dns():
371371 assert result [0 ].ipv4 is not None and result [0 ].ipv4 .public == "192.0.2.1"
372372
373373
374- @pytest .mark .asyncio
375- async def test_dns_service_get_dns_for_instance ():
376- """Test the DNSService get_dns_for_instance method"""
377- mock_client = MagicMock ()
378- dns_service = DNS (mock_client )
379-
380- # Use a valid format for ItemHash (64-character hex string for storage hash)
381- dns1 = Dns (
382- name = "test1.aleph.sh" ,
383- item_hash = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" ,
384- ipv6 = "2001:db8::1" ,
385- ipv4 = IPV4 (public = "192.0.2.1" , local = "10.0.0.1" ),
386- )
387-
388- dns2 = Dns (
389- name = "test2.aleph.sh" ,
390- item_hash = "fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210" ,
391- ipv6 = "2001:db8::2" ,
392- ipv4 = IPV4 (public = "192.0.2.2" , local = "10.0.0.2" ),
393- )
394-
395- # Use AsyncMock instead of a regular async function
396- with patch .object (
397- dns_service , "get_public_dns" , AsyncMock (return_value = [dns1 , dns2 ])
398- ):
399- # Test finding a DNS entry (use the same hash as dns1)
400- result = await dns_service .get_dns_for_instance (
401- vm_hash = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
402- )
403- assert result is not None
404- assert result .name == "test1.aleph.sh"
405-
406- # Test not finding a DNS entry
407- result = await dns_service .get_dns_for_instance (
408- vm_hash = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
409- )
410- assert result is None
411-
412-
413374@pytest .mark .asyncio
414375async def test_crn_service_get_last_crn_version ():
415376 """Test the CrnService get_last_crn_version method"""
0 commit comments