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()
wsdl_local_path=None, wsdl_filename=None, wsdl_correct=None, wsdl_missing_service=None, wsdl_error=None, wsdl_warning=None, ssh_host=None, ssh_username=None, ssh_password=None): ''' MainController test function. Refreshes WSDL and checks for error scenarios. :return: ''' self = case client_id = xroad.get_xroad_subsystem(client) requester_id = xroad.get_xroad_subsystem(requester) query_url = self.config.get('ss1.service_path') query_filename = self.config.get('services.request_template_filename') query_2_filename = self.config.get('services.request_template_filename') query = self.get_xml_query(query_filename) query_2 = self.get_xml_query(query_2_filename) # Immediate queries, no delay needed, no retry allowed. sync_retry = 0 sync_max_seconds = 0 testclient_params = { 'xroadProtocolVersion': self.config.get('services.xroad_protocol'), 'xroadIssue': self.config.get('services.xroad_issue'),
'Server.ServerProxy.ServiceDisabled', 'Server.ClientProxy.*', 'Client.*' ] def test_delete_tls(case, client, provider): self = case ss1_host = self.config.get('ss1.host') ss1_user = self.config.get('ss1.user') ss1_pass = self.config.get('ss1.pass') ss2_host = self.config.get('ss2.host') ss2_user = self.config.get('ss2.user') ss2_pass = self.config.get('ss2.pass') client_id = xroad.get_xroad_subsystem(client) provider_id = xroad.get_xroad_subsystem(provider) testservice_name = self.config.get('services.test_service') wsdl_url = self.config.get('wsdl.remote_path').format( self.config.get('wsdl.service_wsdl')) new_service_url = self.config.get('services.test_service_url') def delete_tls(): self.reload_webdriver(url=ss1_host, username=ss1_user, password=ss1_pass) self.log('2.2.7 delete_tls') self.log('2.2.7-delete setting {0} connection type to HTTP'.format( client_id))
service_url_additional_parameter = 'db' # Additional parameter name for client code to be appended to test service URL service_invalid_url = self.config.get_string('wsdl.invalid_url', 'invalid url') service_invalid_timeouts = ['-1', 'hello', '10error'] # List of timeouts to test service_infinite_timeout = self.config.get_string( 'wsdl.infinite_timeout', '0') # A timeout that should give an infinite timeout warning wsdl_disabled_prefix = self.config.get_string('wsdl.disabled_prefix', 'WSDL DISABLED') wsdl_disabled_class = self.config.get_string('wsdl.disabled_class', 'disabled') client_id = xroad.get_xroad_subsystem(client) def configure_service(): """ :param self: MainController class object :return: None ''""" # TEST PLAN 2.2.2 configure test service self.log('*** 2.2.2 / XT-466') self.reload_webdriver(url=ss2_host, username=ss2_user, password=ss2_pass) # TEST PLAN 2.2.2-1 add test service WSDL
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