@@ -261,38 +261,3 @@ def test_platform_map(self):
261261 self .ndk1 .check_netmiko_conversion ("cisco-device-platform" , platform_map = platform_map ),
262262 "cisco-device-platform" ,
263263 )
264-
265- @mock .patch ("netbox_onboarding.onboard.socket.gethostbyname" )
266- def test_check_ip (self , mock_get_hostbyname ):
267- """Check DNS to IP address."""
268- # Look up response value
269- mock_get_hostbyname .return_value = "192.0.2.1"
270-
271- # Create a Device Keeper object of the device
272- ndk4 = NetdevKeeper (self .onboarding_task4 )
273-
274- # Check that the IP address is returned
275- self .assertTrue (ndk4 .check_ip ())
276-
277- # Run the check to change the IP address
278- self .assertEqual (ndk4 .ot .ip_address , "192.0.2.1" )
279-
280- @mock .patch ("netbox_onboarding.onboard.socket.gethostbyname" )
281- def test_failed_check_ip (self , mock_get_hostbyname ):
282- """Check DNS to IP address failing."""
283- # Look up a failed response
284- mock_get_hostbyname .side_effect = gaierror (8 )
285- ndk5 = NetdevKeeper (self .onboarding_task5 )
286- ndk7 = NetdevKeeper (self .onboarding_task7 )
287-
288- # Check for bad.local raising an exception
289- with self .assertRaises (OnboardException ) as exc_info :
290- ndk5 .check_ip ()
291- self .assertEqual (exc_info .exception .message , "ERROR failed to complete DNS lookup: bad.local" )
292- self .assertEqual (exc_info .exception .reason , "fail-dns" )
293-
294- # Check for exception with prefix address entered
295- with self .assertRaises (OnboardException ) as exc_info :
296- ndk7 .check_ip ()
297- self .assertEqual (exc_info .exception .reason , "fail-prefix" )
298- self .assertEqual (exc_info .exception .message , "ERROR appears a prefix was entered: 192.0.2.1/32" )
0 commit comments