@@ -143,35 +143,6 @@ def _delete_object(cls, resource_link):
143143 element .find_element (By .CLASS_NAME , "deletelink" ).click ()
144144 cls .base_driver .find_element (By .XPATH , '//input[@type="submit"]' ).click ()
145145
146- def test_topology_graph (self ):
147- path = "/admin/topology/topology"
148- label = "automated-selenium-test-02"
149- self .login ()
150- self .create_network_topology (label )
151- self .get_resource (label , path , select_field = "field-label" )
152- # Click on "Visualize topology graph" button
153- self .find_element (By .CSS_SELECTOR , "input.visualizelink" ).click ()
154- # Click on sidebar handle
155- self .find_element (By .CSS_SELECTOR , "button.sideBarHandle" ).click ()
156- # Verify topology label
157- self .assertEqual (
158- self .find_element (By .CSS_SELECTOR , ".njg-valueLabel" ).text .lower (),
159- label ,
160- )
161- try :
162- console_logs = self .console_error_check ()
163- self .assertEqual (len (console_logs ), 0 )
164- except AssertionError :
165- print ("Browser console logs" , console_logs )
166- self .fail ()
167- self .action_on_resource (label , path , "delete_selected" )
168- self .assertNotIn ("<li>Nodes: " , self .web_driver .page_source )
169- self .action_on_resource (label , path , "update_selected" )
170-
171- self .action_on_resource (label , path , "delete_selected" )
172- self ._wait_until_page_ready ()
173- self .assertIn ("<li>Nodes: " , self .web_driver .page_source )
174-
175146 def test_admin_login (self ):
176147 self .login ()
177148 self .login (driver = self .second_driver )
@@ -206,41 +177,9 @@ def test_default_topology(self):
206177 "test-device" , "/admin/topology/topology/" , select_field = "field-label"
207178 )
208179
209- def test_create_prefix_users (self ):
210- self .login ()
211- prefix_objname = "automated-prefix-test-01"
212- # Create prefix users
213- self .open ("/admin/openwisp_radius/radiusbatch/add/" )
214- self .find_element (By .NAME , "strategy" ).find_element (
215- By .XPATH , '//option[@value="prefix"]'
216- ).click ()
217- self .find_element (By .NAME , "organization" ).find_element (
218- By .XPATH , '//option[text()="default"]'
219- ).click ()
220- self .find_element (By .NAME , "name" ).send_keys (prefix_objname )
221- self .find_element (By .NAME , "prefix" ).send_keys ("automated-prefix" )
222- self .find_element (By .NAME , "number_of_users" ).send_keys ("1" )
223- self .find_element (By .NAME , "_save" ).click ()
224- # Check PDF available
225- self .get_resource (prefix_objname , "/admin/openwisp_radius/radiusbatch/" )
226- self .objects_to_delete .append (self .base_driver .current_url )
227- prefix_pdf_file_path = self .base_driver .find_element (
228- By .XPATH , '//a[text()="Download User Credentials"]'
229- ).get_property ("href" )
230- reqHeader = {
231- "Cookie" : f"sessionid={ self .base_driver .get_cookies ()[0 ]['value' ]} "
232- }
233- curlRequest = request .Request (prefix_pdf_file_path , headers = reqHeader )
234- try :
235- if request .urlopen (curlRequest , context = self .ctx ).getcode () != 200 :
236- raise ValueError
237- except (urlerror .HTTPError , OSError , ConnectionResetError , ValueError ) as error :
238- self .fail (f"Cannot download PDF file: { error } " )
239-
240180 def test_console_errors (self ):
241181 url_list = [
242182 "/admin/" ,
243- "/admin/geo/location/add/" ,
244183 "/accounts/password/reset/" ,
245184 "/admin/config/device/add/" ,
246185 "/admin/config/template/add/" ,
@@ -262,7 +201,6 @@ def test_console_errors(self):
262201 "/admin/firmware_upgrader/category/add/" ,
263202 ]
264203 change_form_list = [
265- ["automated-selenium-location01" , "/admin/geo/location/" ],
266204 ["users" , "/admin/openwisp_radius/radiusgroup/" ],
267205 ["default-management-vpn" , "/admin/config/template/" ],
268206 ["default" , "/admin/config/vpn/" ],
@@ -272,7 +210,6 @@ def test_console_errors(self):
272210 ["test_superuser2" , "/admin/openwisp_users/user/" , "field-username" ],
273211 ]
274212 self .login ()
275- self .create_mobile_location ("automated-selenium-location01" )
276213 self .create_superuser ("sample@email.com" , "test_superuser2" )
277214 # url_list tests
278215 for url in url_list :
@@ -285,35 +222,6 @@ def test_console_errors(self):
285222 self .assertEqual ([], self .console_error_check ())
286223 self .assertIn ("OpenWISP" , self .base_driver .title )
287224
288- def test_websocket_marker (self ):
289- """Ensures that the websocket service is running correctly.
290-
291- This test uses selenium, it creates a new location, sets a map
292- marker and checks if the location changed int a second window.
293- """
294- location_name = "automated-websocket-selenium-loc01"
295- self .login ()
296- self .login (driver = self .second_driver )
297- self .create_mobile_location (location_name )
298- self .get_resource (location_name , "/admin/geo/location/" )
299- self .get_resource (
300- location_name , "/admin/geo/location/" , driver = self .second_driver
301- )
302- self .find_element (By .NAME , "is_mobile" , driver = self .base_driver ).click ()
303- mark = len (
304- self .find_elements (
305- By .CLASS_NAME , "leaflet-marker-icon" , wait_for = "invisibility"
306- )
307- )
308- self .assertEqual (mark , 0 )
309- self .add_mobile_location_point (location_name , driver = self .second_driver )
310- mark = len (
311- self .find_elements (
312- By .CLASS_NAME , "leaflet-marker-icon" , wait_for = "presence"
313- )
314- )
315- self .assertEqual (mark , 1 )
316-
317225 def test_add_superuser (self ):
318226 """Create new user to ensure a new user can be added."""
319227 self .login ()
@@ -326,6 +234,7 @@ def test_add_superuser(self):
326234 def test_forgot_password (self ):
327235 """Test forgot password to ensure that postfix is working properly."""
328236
237+ self .logout ()
329238 self .open ("/accounts/password/reset/" )
330239 self .find_element (By .NAME , "email" ).send_keys ("admin@example.com" )
331240 self .find_element (By .XPATH , '//button[@type="submit"]' ).click ()
@@ -362,9 +271,7 @@ def test_celery(self):
362271 "openwisp_firmware_upgrader.tasks.create_all_device_firmwares" ,
363272 "openwisp_firmware_upgrader.tasks.create_device_firmware" ,
364273 "openwisp_firmware_upgrader.tasks.upgrade_firmware" ,
365- "openwisp_monitoring.check.tasks.auto_create_config_check" ,
366- "openwisp_monitoring.check.tasks.auto_create_iperf3_check" ,
367- "openwisp_monitoring.check.tasks.auto_create_ping" ,
274+ "openwisp_monitoring.check.tasks.auto_create_check" ,
368275 "openwisp_monitoring.check.tasks.perform_check" ,
369276 "openwisp_monitoring.check.tasks.run_checks" ,
370277 "openwisp_monitoring.device.tasks.delete_wifi_clients_and_sessions" ,
@@ -376,7 +283,6 @@ def test_celery(self):
376283 "openwisp_monitoring.monitoring.tasks.migrate_timeseries_database" ,
377284 "openwisp_monitoring.monitoring.tasks.timeseries_batch_write" ,
378285 "openwisp_monitoring.monitoring.tasks.timeseries_write" ,
379- "openwisp_monitoring.monitoring.tasks.delete_timeseries" ,
380286 "openwisp_notifications.tasks.delete_ignore_object_notification" ,
381287 "openwisp_notifications.tasks.delete_notification" ,
382288 "openwisp_notifications.tasks.delete_obsolete_objects" ,
@@ -385,7 +291,6 @@ def test_celery(self):
385291 "openwisp_notifications.tasks.ns_organization_user_deleted" ,
386292 "openwisp_notifications.tasks.ns_register_unregister_notification_type" ,
387293 "openwisp_notifications.tasks.update_org_user_notificationsetting" ,
388- "openwisp_notifications.tasks.update_superuser_notification_settings" ,
389294 "openwisp_radius.tasks.cleanup_stale_radacct" ,
390295 "openwisp_radius.tasks.convert_called_station_id" ,
391296 "openwisp_radius.tasks.deactivate_expired_users" ,
@@ -490,7 +395,4 @@ def test_containers_down(self):
490395
491396
492397if __name__ == "__main__" :
493- suite = unittest .TestSuite ()
494- suite .addTest (TestServices ("test_topology_graph" ))
495- runner = unittest .TextTestRunner (verbosity = 2 )
496- runner .run (suite )
398+ unittest .main (verbosity = 2 )
0 commit comments