def test_xroad_configure_service(self): main = MainController(self) # Set test name and number main.test_number = '2.2.2' main.test_name = self.__class__.__name__ ss_host = main.config.get('ss2.host') ss_user = main.config.get('ss2.user') ss_pass = main.config.get('ss2.pass') client = xroad.split_xroad_id(main.config.get('ss2.client_id')) wsdl_url = main.config.get('wsdl.remote_path').format(main.config.get('wsdl.service_wsdl')) # Delete the added service test_delete_service = configure_service_2_2_2.test_delete_service(case=main, client=client, wsdl_url=wsdl_url) try: # Delete service main.reload_webdriver(url=ss_host, username=ss_user, password=ss_pass) test_delete_service() except: main.log('XroadDeleteService: Failed to delete service') assert False finally: # Test teardown main.tearDown()
def test_add_central_service_2_2_8(self): main = MainController(self) # Set test name and number main.test_number = '2.2.8' main.test_name = self.__class__.__name__ main.start_mock_service() cs_host = main.config.get('cs.host') cs_user = main.config.get('cs.user') cs_pass = main.config.get('cs.pass') ss2_host = main.config.get('ss2.host') ss2_user = main.config.get('ss2.user') ss2_pass = main.config.get('ss2.pass') requester = xroad.split_xroad_id(main.config.get('ss1.client_id')) provider_2 = xroad.split_xroad_id(main.config.get('services.central_service_provider_2_id')) central_service_name = main.config.get('services.central_service') wsdl_url = main.config.get('wsdl.remote_path').format(main.config.get('wsdl.service_wsdl')) wait_sync_retry_delay = main.config.get('services.request_sync_delay') sync_max_seconds = main.config.get('services.request_sync_timeout') delete_service = configure_service_2_2_2.test_delete_service(main, client=provider_2, wsdl_url=wsdl_url) delete_central_service = add_central_service_2_2_8.test_delete_central_service(main, provider=provider_2, requester=requester, central_service_name=central_service_name, sync_max_seconds=sync_max_seconds, wait_sync_retry_delay=wait_sync_retry_delay) try: try: # Go to CS main page (login again if necessary) and edit the central service main.reload_webdriver(url=cs_host, username=cs_user, password=cs_pass) # Delete central service delete_central_service() except: main.log('XroadDeleteCentralService: Failed to delete central service') assert False finally: try: # Go to SS2 main page (re-login if necessary) and delete the newly created service main.reload_webdriver(url=ss2_host, username=ss2_user, password=ss2_pass) delete_service() except: main.log('XroadDeleteCentralService: failed to delete security server service') assert False finally: # Test teardown main.tearDown()
def test_add_to_acl(self): main = MainController(self) # Set test name and number main.test_number = '2.1.8' main.test_name = self.__class__.__name__ ss_host = main.config.get('ss2.host') ss_user = main.config.get('ss2.user') ss_pass = main.config.get('ss2.pass') client = xroad.split_xroad_id(main.config.get('ss2.client_id')) requester = xroad.split_xroad_id(main.config.get('ss1.client_id')) wsdl_url = main.config.get('wsdl.remote_path').format(main.config.get('wsdl.service_wsdl')) subject_list = [xroad.get_xroad_subsystem(requester)] service_name = main.config.get('services.test_service') # TEST PLAN 2.1.8 (2.1.8-3 subitem 1 - "Add Selected to ACL") # Add some subjects (subject_list) to ACL test_add_subjects = add_to_acl_2_1_8.test_add_subjects(main, client=client, wsdl_url=wsdl_url, service_name=service_name, service_subjects=subject_list, remove_data=True, allow_remove_all=False) # TEST PLAN 2.1.8 (2.1.8-3 subitem 2 - "Add All to ACL") # Add all subjects to ACL test_add_all_subjects = add_to_acl_2_1_8.test_add_all_subjects(main, client=client, wsdl_url=wsdl_url, service_name=service_name, remove_data=True, allow_remove_all=True) try: # Test add one user to ACL main.reload_webdriver(url=ss_host, username=ss_user, password=ss_pass) test_add_subjects() # Test add all to ACL main.reload_webdriver(url=ss_host, username=ss_user, password=ss_pass) test_add_all_subjects() except: main.log('2.1.8 failed') raise finally: # Test teardown main.tearDown()
def test_deactivate_wsdl(self): main = MainController(self) # Set test name and number main.test_number = '2.2.6' main.test_name = self.__class__.__name__ ss_host = main.config.get('ss2.host') ss_user = main.config.get('ss2.user') ss_pass = main.config.get('ss2.pass') client = xroad.split_xroad_id(main.config.get('ss2.client_id')) requester = xroad.split_xroad_id(main.config.get('ss1.client_id')) wsdl_url = main.config.get('wsdl.remote_path').format( main.config.get('wsdl.service_wsdl')) # Configure the service test_deactivate_wsdl = deactivate_wsdl_2_2_6.test_disable_wsdl( main, client=client, wsdl_url=wsdl_url, requester=requester) test_reactivate_wsdl = deactivate_wsdl_2_2_6.test_enable_wsdl( main, client=client, wsdl_url=wsdl_url, requester=requester) try: main.reload_webdriver(url=ss_host, username=ss_user, password=ss_pass) test_deactivate_wsdl() except: main.log('XroadDeactivateWsdl: Failed to deactivate WSDL') main.save_exception_data() assert False finally: try: main.reload_webdriver(url=ss_host, username=ss_user, password=ss_pass) test_reactivate_wsdl() except: main.log('XroadDeactivateWsdl: Failed to reactivate WSDL') main.save_exception_data() assert False finally: # Test teardown main.tearDown(save_exception=False)
def test_xroad_member_access(self): main = MainController(self) # Set test name and number main.test_number = '2.2.9' main.test_name = self.__class__.__name__ ss2_host = main.config.get('ss2.host') ss2_user = main.config.get('ss2.user') ss2_pass = main.config.get('ss2.pass') wsdl_url = main.config.get('wsdl.remote_path').format( main.config.get('wsdl.service_wsdl')) service_name = main.config.get('services.test_service') client = xroad.split_xroad_id(main.config.get('ss2.client_id')) requester = xroad.split_xroad_id(main.config.get('ss2.client2_id')) # Configure the test test_xroad_member_access = xroad_member_access_2_2_9.test_xroad_member_access( main, client=client, requester=requester, wsdl_url=wsdl_url, service_name=service_name) # Set Security Server 2 main.reload_webdriver(url=ss2_host, username=ss2_user, password=ss2_pass) try: # Test local TLS test_xroad_member_access() except: main.save_exception_data() assert False finally: # Test teardown main.tearDown(save_exception=False)
def test_xroad_configure_service(self): main = MainController(self) # Set test name and number main.test_number = '2.2.2' main.test_name = self.__class__.__name__ ss_host = main.config.get('ss2.host') ss_user = main.config.get('ss2.user') ss_pass = main.config.get('ss2.pass') client = xroad.split_xroad_id(main.config.get('ss2.client_id')) requester = xroad.split_xroad_id(main.config.get('ss1.client_id')) wsdl_url = main.config.get('wsdl.remote_path').format(main.config.get('wsdl.service_wsdl')) service_name = main.config.get('services.test_service') # xroadGetRandom service_2_name = main.config.get('services.test_service_2') # bodyMassIndex subject_list = [xroad.get_xroad_subsystem(requester)] # Configure the service test_configure_service = configure_service_2_2_2.test_configure_service(case=main, client=client, check_add_errors=False, check_edit_errors=False, check_parameter_errors=False, service_name=service_name) # Add the subject to ACL test_configure_service_acl = add_to_acl_2_1_8.test_add_subjects(case=main, client=client, wsdl_url=wsdl_url, service_name=service_name, service_subjects=subject_list, remove_data=False, allow_remove_all=False) test_configure_service_acl_2 = add_to_acl_2_1_8.test_add_subjects(case=main, client=client, wsdl_url=wsdl_url, service_name=service_2_name, service_subjects=subject_list, remove_data=False, allow_remove_all=False) # Enable the service test_enable_service = configure_service_2_2_2.test_enable_service(case=main, client=client, wsdl_url=wsdl_url) # Delete the added service test_delete_service = configure_service_2_2_2.test_delete_service(case=main, client=client, wsdl_url=wsdl_url) try: # Open webdriver main.reload_webdriver(url=ss_host, username=ss_user, password=ss_pass) # TEST PLAN 2.2.2-1, 2.2.2-2 add WSDL and configure service test_configure_service() # TEST PLAN 2.2.2-3 configure service ACL main.log('2.2.2-3 configure service ACL') main.reload_webdriver(url=ss_host, username=ss_user, password=ss_pass) test_configure_service_acl() # TEST PLAN 2.2.2-3 configure second service ACL main.log('2.2.2-3 configure second service ACL') main.reload_webdriver(url=ss_host, username=ss_user, password=ss_pass) test_configure_service_acl_2() # TEST PLAN 2.2.2-4 enable service main.reload_webdriver(url=ss_host, username=ss_user, password=ss_pass) test_enable_service() except: main.log('XroadConfigureService: Failed to configure service') main.save_exception_data() try: # Delete service main.reload_webdriver(url=ss_host, username=ss_user, password=ss_pass) test_delete_service() except: main.log('XroadConfigureService: Failed to delete added data.') main.save_exception_data() assert False finally: # Test teardown main.tearDown()
def test_add_central_service_2_2_8(self): main = MainController(self) # Set test name and number main.test_number = '2.2.8' main.test_name = self.__class__.__name__ cs_host = main.config.get('cs.host') cs_user = main.config.get('cs.user') cs_pass = main.config.get('cs.pass') ss2_host = main.config.get('ss2.host') ss2_user = main.config.get('ss2.user') ss2_pass = main.config.get('ss2.pass') requester = xroad.split_xroad_id(main.config.get('ss1.client_id')) provider = xroad.split_xroad_id(main.config.get('services.central_service_provider_id')) provider_2 = xroad.split_xroad_id(main.config.get('services.central_service_provider_2_id')) service_name = main.config.get('services.test_service') central_service_name = main.config.get('services.central_service') wsdl_url = main.config.get('wsdl.remote_path').format(main.config.get('wsdl.service_wsdl')) wait_sync_retry_delay = main.config.get('services.request_sync_delay') sync_max_seconds = main.config.get('services.request_sync_timeout') requester_id = xroad.get_xroad_subsystem(requester) # Configure the service (2.2.8-1 to 2.2.8-3) add_central_service = add_central_service_2_2_8.test_add_central_service(main, provider=provider, requester=requester, central_service_name=central_service_name, sync_max_seconds=sync_max_seconds, wait_sync_retry_delay=wait_sync_retry_delay) # Configure a new service (2.2.8-4) configure_service = configure_service_2_2_2.test_configure_service(main, client=provider_2, service_name=service_name, check_add_errors=False, check_edit_errors=False, check_parameter_errors=False) # Add subject to ACL (2.2.8-4) configure_service_acl = add_to_acl_2_1_8.test_add_subjects(main, client=provider_2, wsdl_url=wsdl_url, service_name=service_name, service_subjects=[requester_id], remove_data=False, allow_remove_all=False) # Enable new service (2.2.8-4) enable_service = configure_service_2_2_2.test_enable_service(main, client=provider_2, wsdl_url=wsdl_url) # Delete new service (undo the changes we made for 2.2.8-4) delete_service = configure_service_2_2_2.test_delete_service(main, client=provider_2, wsdl_url=wsdl_url) # Configure central service (2.2.8-5 to 2.2.8-6) edit_central_service = add_central_service_2_2_8.test_edit_central_service(main, provider=provider_2, requester=requester, central_service_name=central_service_name, sync_max_seconds=sync_max_seconds, wait_sync_retry_delay=wait_sync_retry_delay) # Delete central service (undo changes we made for 2.2.8) delete_central_service = add_central_service_2_2_8.test_delete_central_service(main, central_service_name=central_service_name, provider=provider_2, requester=requester, sync_max_seconds=sync_max_seconds, wait_sync_retry_delay=wait_sync_retry_delay) try: # TEST PLAN 2.2.8-1, 2.2.8-2, 2.2.8-3 add central service main.log('XroadAddCentralService: Add central service') # Set Central Server UI main.reload_webdriver(url=cs_host, username=cs_user, password=cs_pass) add_central_service() # TEST PLAN 2.2.8-4 configure new provider for central service main.log('XroadAddCentralService: Configure service parameters (using 2.2.2)') # Set Security Server 2 and configure service parameters main.reload_webdriver(url=ss2_host, username=ss2_user, password=ss2_pass) configure_service() # TEST PLAN 2.2.8-4 configure new provider for central service (set access using ACL) main.log('XroadAddCentralService: Configure service ACL (using 2.1.8)') # Go to SS2 main page (no need to login again) and configure ACL main.reload_webdriver(url=ss2_host) configure_service_acl() # TEST PLAN 2.2.8-4 enable the new provider service main.log('XroadAddCentralService: Enable service (using 2.2.2)') # Go to SS2 main page (no need to login again) and enable service main.reload_webdriver(url=ss2_host) enable_service() # TEST PLAN 2.2.8-5, 2.2.8-6 edit and test the central service with the new provider main.log('XroadAddCentralService: Edit central service') # Go to CS main page (login again if necessary) and edit the central service main.reload_webdriver(url=cs_host, username=cs_user, password=cs_pass) edit_central_service() except Exception, e: main.log('XroadAddCentralService: Error, undoing changes') main.save_exception_data() try: # Go to CS main page (login again if necessary) and edit the central service main.reload_webdriver(url=cs_host, username=cs_user, password=cs_pass) try: # Delete central service delete_central_service() except: main.log('XroadAddCentralService: Error deleting central service') main.save_exception_data() raise finally: try: # Go to SS2 main page (re-login if necessary) and delete the newly created service main.reload_webdriver(url=ss2_host, username=ss2_user, password=ss2_pass) delete_service() except: main.log('XroadAddCentralService: Error deleting security server service') main.save_exception_data() assert False except: assert False
def test_refresh_wsdl(self): main = MainController(self) # Set test name and number main.test_number = '2.2.5' main.test_name = self.__class__.__name__ ss_host = main.config.get('ss2.host') ss_user = main.config.get('ss2.user') ss_pass = main.config.get('ss2.pass') ssh_host = main.config.get('wsdl.ssh_host') ssh_username = main.config.get('wsdl.ssh_user') ssh_password = main.config.get('wsdl.ssh_pass') client = xroad.split_xroad_id(main.config.get('ss2.client_id')) requester = xroad.split_xroad_id(main.config.get('ss1.client_id')) wsdl_remote_path = main.config.get('wsdl.remote_path') wsdl_local_path = main.config.get('wsdl.local_path') wsdl_filename = main.config.get('wsdl.service_wsdl') wsdl_url = wsdl_remote_path.format(wsdl_filename) wsdl_correct = main.config.get('wsdl.service_correct_filename') wsdl_missing_service = main.config.get( 'wsdl.service_single_service_filename') wsdl_error = main.config.get('wsdl.service_wsdl_error_filename') wsdl_warning = main.config.get('wsdl.service_wsdl_warning_filename') service_name = main.config.get('services.test_service_2') service_2_name = main.config.get('services.test_service') # Configure the service test_refresh_wsdl = refresh_wsdl_2_2_5.test_refresh_wsdl( main, client=client, wsdl_url=wsdl_url, service_name=service_name, service_name_2=service_2_name, requester=requester, wsdl_path=wsdl_remote_path, wsdl_local_path=wsdl_local_path, wsdl_filename=wsdl_filename, wsdl_correct=wsdl_correct, wsdl_missing_service=wsdl_missing_service, wsdl_error=wsdl_error, wsdl_warning=wsdl_warning, ssh_host=ssh_host, ssh_username=ssh_username, ssh_password=ssh_password) # Reset the service test_reset_wsdl = refresh_wsdl_2_2_5.test_reset_wsdl( main, wsdl_local_path=wsdl_local_path, wsdl_filename=wsdl_filename, wsdl_correct=wsdl_correct, ssh_host=ssh_host, ssh_username=ssh_username, ssh_password=ssh_password) try: main.reload_webdriver(url=ss_host, username=ss_user, password=ss_pass) test_refresh_wsdl() except: main.log('XroadRefreshWsdl: Failed to refresh WSDL') main.save_exception_data() try: test_reset_wsdl() except: main.log( 'XroadRefreshWsdl: Failed to reset WSDL to original file') main.save_exception_data() assert False finally: # Test teardown main.tearDown(save_exception=False)