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_xroad_audit_log(self): ''' audit.log checking test. Checks if audit.log of a specified server contains specified (in configuration or command-line parameters) entries. Test succeeds if all of the entries are found; fails otherwise. :return: None ''' main = MainController(self) # Set test name and number main.test_number = 'LOGCHECK' main.test_name = self.__class__.__name__ # Get parameters from the configuration file. # We can supply a "server" name to this test. This means that it uses this name as a category name and # fetches ssh_host, ssh_user and ssh_pass of this category. For example, you can set audit.server=ss1 and # the values that are used are ss1.ssh_host, ss1.ssh_user, and ss1.ssh_pass respectively. audit_server = main.config.get('audit.server') if audit_server is not None: # audit.server was supplied so we're reading data from the sections xroad_server = main.config.get('{0}.ssh_host'.format(audit_server)) ssh_username = main.config.get('{0}.ssh_user'.format(audit_server)) ssh_password = main.config.get('{0}.ssh_pass'.format(audit_server)) else: # If audit.server was not supplied, we read each parameter separately xroad_server = main.config.get('audit.ssh_host') ssh_username = main.config.get('audit.ssh_user') ssh_password = main.config.get('audit.ssh_pass') # Get logfile logfile = main.config.get('audit.logfile') # Get data to be checked check_json = main.config.get('audit.check-logs') # Read data from this line from_line = main.config.get_int('audit.from-line', 0) # Because the supplied parameter may also be a string, use try-except try: check_entries = json.loads(check_json) except (ValueError, TypeError): check_entries = [check_json] sys.exc_clear() # Configure the service test_audit_log = audit_log.test_audit_log(case=main, xroad_server=xroad_server, ssh_username=ssh_username, ssh_password=ssh_password, logfile=logfile) try: # Run audit.log checking test_audit_log(check_lines=check_entries, from_line=from_line) except: main.log('XroadAuditLog: audit.log check failed for: {0}'.format(check_json)) main.save_exception_data() raise finally: # Test teardown main.tearDown()
def test_loggin_in_central_server_2_11_1(self): main = MainController(self) # Set test name and number main.test_number = '2.11.1' main.test_name = self.__class__.__name__ main.url = main.config.get('cs.host') main.username = main.config.get('cs.user') main.password = main.config.get('cs.pass') if main.driver is None: main.reset_webdriver(main.url, username=main.username, password=main.password, init_new_webdriver=False) group = main.config.get('cs.global_group') server_id = main.config.get('ss1.server_name') client_id = main.config.get('ss1.client2_id') client_name = main.config.get('ss1.client2_name') client_name2 = main.config.get('ss1.client2_name2') server_groups = '{0},{1},{2}'.format( main.config.get('xroad.registration_officer_group'), main.config.get('xroad.system_administrator_group'), main.config.get('xroad.security_officer_group')) users = { 'user1': { 'username': main.config.get('xroad.user1'), 'password': main.config.get('xroad.user1'), 'group': server_groups }, 'user2': { 'username': main.config.get('xroad.user2'), 'password': main.config.get('xroad.user2'), 'group': server_groups }, 'user3': { 'username': main.config.get('xroad.user3'), 'password': main.config.get('xroad.user3'), 'group': server_groups } } main.log('TEST: LOGGING TEST IN CENTRAL SERVER') test_func = logging_in_cs_2_11_1.test_test( main.config.get('cs.ssh_host'), main.config.get('cs.ssh_user'), main.config.get('cs.ssh_pass'), group=group, server_id=server_id, client_id=client_id, client_name=client_name, client_name2=client_name2, users=users) test_func(main) 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_parse_user_input_SS_41(self): main = MainController(self) # Set test name and number main.test_number = 'SS_41' main.test_name = self.__class__.__name__ main.log('TEST: PARSE USER INPUT') main.url = main.config.get('ss1.host') main.username = main.config.get('ss1.user') main.password = main.config.get('ss1.pass') main.reset_webdriver(main.url, main.username, main.password) test_func = parse_user_input_SS_41.test_01() test_func(main) test_func = parse_user_input_SS_41.test_02() test_func(main) test_func = parse_user_input_SS_41.test_03() test_func(main) test_func = parse_user_input_SS_41.test_04() test_func(main) test_func = parse_user_input_SS_41.test_05() test_func(main) test_func = parse_user_input_SS_41.test_06() test_func(main) main.tearDown() main.url = main.config.get('cs.host') main.username = main.config.get('cs.user') main.password = main.config.get('cs.pass') main.reset_webdriver(main.url, main.username, main.password) test_func = parse_user_input_SS_41.test_07() test_func(main) test_func = parse_user_input_SS_41.test_08() test_func(main) test_func = parse_user_input_SS_41.test_09() test_func(main) test_func = parse_user_input_SS_41.test_10() test_func(main) test_func = parse_user_input_SS_41.test_11() test_func(main) main.tearDown()
def test_changing_database_rows_with_cs_gui_2_9_1(self): main = MainController(self) # Set test name and number main.test_number = '2.9.1' main.test_name = self.__class__.__name__ main.url = main.config.get('cs.host') main.reset_webdriver(main.url) groups = main.config.get('xroad.registration_officer_group') users = { 'user1': { 'username': main.config.get('xroad.user1'), 'password': main.config.get('xroad.user1'), 'group': groups }, 'user2': { 'username': main.config.get('xroad.user2'), 'password': main.config.get('xroad.user2'), 'group': groups }, 'user3': { 'username': main.config.get('xroad.user3'), 'password': main.config.get('xroad.user3'), 'group': groups }, 'databaseuser': { 'username': main.config.get('xroad.centerui_db_user'), 'password': main.config.get('xroad.centerui_db_pass'), 'db_name': main.config.get('xroad.centerui_db_name') } } client_id = main.config.get('ss1.client2_id') client_name = main.config.get('ss1.client2_name') client_name2 = main.config.get('ss1.client2_name3') main.log( 'TEST: CHANGING DATABASE ROWS WITH USER INTERFACE IN CENTRAL SERVER' ) test_func = changing_database_rows_with_cs_gui_2_9_1.test_test( ssh_host=main.config.get('cs.ssh_host'), ssh_username=main.config.get('cs.ssh_user'), ssh_password=main.config.get('cs.ssh_pass'), users=users, client_id=client_id, client_name=client_name, client_name2=client_name2) test_func(main) main.tearDown()
def test_client_deletion(self): main = MainController(self) # Set test name and number main.test_number = '2.2.1' main.test_name = self.__class__.__name__ main.url = main.config.get('cs.host') main.username = main.config.get('cs.user') main.password = main.config.get('cs.pass') main.reset_webdriver(url=main.url, username=main.username, password=main.password, close_previous=False, init_new_webdriver=False) main.management_services = xroad.split_xroad_subsystem( main.config.get('ss1.management_id')) cs_member = xroad.split_xroad_id(main.config.get('ss1.client_id')) ss1_client = xroad.split_xroad_id(main.config.get('ss1.client_id')) ss2_client = xroad.split_xroad_id(main.config.get('ss2.client_id')) ss2_client_2 = xroad.split_xroad_id(main.config.get('ss2.client2_id')) cs_member_name = main.config.get('ss1.client_name') ss1_client_name = main.config.get('ss1.client_name') ss2_client_name = main.config.get('ss2.client_name') ss2_client_2_name = main.config.get('ss2.client2_name') main.log('Removing added data from 2.2.1') test_func = client_registration_in_ss_2_2_1.test_remove( main.config.get('cs.host'), main.config.get('cs.user'), main.config.get('cs.pass'), main.config.get('ss1.host'), main.config.get('ss1.user'), main.config.get('ss1.pass'), main.config.get('ss2.host'), main.config.get('ss2.user'), main.config.get('ss2.pass'), cs_new_member=cs_member, cs_member_name=cs_member_name, ss1_client=ss1_client, ss1_client_name=ss1_client_name, ss2_client=ss2_client, ss2_client_name=ss2_client_name, ss2_client_2=ss2_client_2, ss2_client_2_name=ss2_client_2_name) test_func(main) 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_client_registration(self): main = MainController(self) # Set test name and number main.test_number = '2.2.1' main.test_name = self.__class__.__name__ main.url = main.config.get('cs.host') main.username = main.config.get('cs.user') main.password = main.config.get('cs.pass') remove_added_data = False main.management_services = xroad.split_xroad_subsystem( main.config.get('ss1.management_id')) cs_member = xroad.split_xroad_id(main.config.get('ss1.client_id')) ss1_client = xroad.split_xroad_id(main.config.get('ss1.client_id')) ss2_client = xroad.split_xroad_id(main.config.get('ss2.client_id')) ss2_client_2 = xroad.split_xroad_id(main.config.get('ss2.client2_id')) cs_member_name = main.config.get('ss1.client_name') ss1_client_name = main.config.get('ss1.client_name') ss2_client_name = main.config.get('ss2.client_name') ss2_client_2_name = main.config.get('ss2.client2_name') main.log('TEST: REGISTERING SECURITY SERVER CLIENT') test_func = client_registration_in_ss_2_2_1.test_test( main, main.config.get('cs.host'), main.config.get('cs.user'), main.config.get('cs.pass'), main.config.get('ss1.host'), main.config.get('ss1.user'), main.config.get('ss1.pass'), main.config.get('ss2.host'), main.config.get('ss2.user'), main.config.get('ss2.pass'), cs_new_member=cs_member, cs_member_name=cs_member_name, ss1_client=ss1_client, ss1_client_name=ss1_client_name, ss2_client=ss2_client, ss2_client_name=ss2_client_name, ss2_client_2=ss2_client_2, ss2_client_2_name=ss2_client_2_name, remove_added_data=remove_added_data) test_func() main.tearDown()
def test_registration_failures_213(self): main = MainController(self) # Set test name and number main.test_number = '2.1.3' main.test_name = self.__class__.__name__ main.url = main.config.get('ss1.host') main.username = main.config.get('ss1.user') main.password = main.config.get('ss1.pass') main.reset_webdriver(main.url, main.username, main.password) main.log('TEST: CERTIFYING SECURITY SERVER CLIENTS FAILURES') fail_test_func = client_certification_2_1_3.failing_tests() fail_test_func(main) 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_security_server_client_registration_2_1_3(self): main = MainController(self) # Set test name and number main.test_number = '2.1.3' main.test_name = self.__class__.__name__ main.url = main.config.get('ss2.host') main.username = main.config.get('ss2.user') main.password = main.config.get('ss2.pass') main.reset_webdriver(main.url, main.username, main.password) main.log('TEST: CERTIFYING SECURITY SERVER CLIENTS') # ss1_client = xroad.split_xroad_id('SUBSYSTEM : XTEE-CI-XM : GOV : 00000001 : MockSystemGatling') test_func = client_certification_2_1_3.test('00000001', 'GOV') test_func(main) main.tearDown()
def test_changing_database_rows_with_ss_gui_2_10_1(self): main = MainController(self) # Set test name and number main.test_number = '2.10.1' main.test_name = self.__class__.__name__ main.url = main.config.get('ss1.host') if main.driver is None: main.reset_webdriver(main.url, init_new_webdriver=False) users = { 'user1': { 'username': main.config.get('xroad.user1'), 'password': main.config.get('xroad.user1'), 'group': main.config.get('xroad.registration_officer_group') }, 'user2': { 'username': main.config.get('xroad.user2'), 'password': main.config.get('xroad.user2'), 'group': main.config.get('xroad.registration_officer_group') }, 'user3': { 'username': main.config.get('xroad.user3'), 'password': main.config.get('xroad.user3'), 'group': main.config.get('xroad.registration_officer_group') }, 'databaseuser': { 'username': main.config.get('xroad.serverconf_db_user'), 'password': main.config.get('xroad.serverconf_db_password'), 'db_name': main.config.get('xroad.serverconf_db_name') } } client_id = main.config.get('ss1.client3_id') main.log( 'TEST: CHANGING DATABASE ROWS WITH USER INTERFACE IN SECURITY SERVER' ) test_func = changing_database_rows_with_ss_gui_2_10_1.test_test( ssh_host=main.config.get('ss1.ssh_host'), ssh_username=main.config.get('ss1.ssh_user'), ssh_password=main.config.get('ss1.ssh_pass'), users=users, client_id=client_id) test_func(main) main.tearDown()
def test_tls_227(self): main = MainController(self) client = xroad.split_xroad_id(main.config.get('ss1.client_id')) provider = xroad.split_xroad_id(main.config.get('ss2.client_id')) # Configure the tests delete_local_tls = local_tls_2_2_7.test_delete_tls(case=main, client=client, provider=provider) try: # Delete internal certificates from the servers delete_local_tls() except: main.log( 'XroadDeleteLocalTls: failed to remove TLS from local service') assert False finally: # Test teardown main.tearDown()
def test_tls_227(self): main = MainController(self) # Set test name and number main.test_number = '2.2.7' main.test_name = self.__class__.__name__ client = xroad.split_xroad_id(main.config.get('ss1.client_id')) provider = xroad.split_xroad_id(main.config.get('ss2.client_id')) # Configure the tests test_local_tls = local_tls_2_2_7.test_tls(case=main, client=client, provider=provider) delete_local_tls = local_tls_2_2_7.test_delete_tls(case=main, client=client, provider=provider) try: # Test local TLS test_local_tls() except: main.log( 'XroadLocalTls: Failed to configure TLS for local service') main.save_exception_data() # Delete internal certificates from the servers try: delete_local_tls() except: main.save_exception_data() main.log( 'XroadLocalTls: failed to remove TLS from local service') assert False finally: # Test teardown main.tearDown(save_exception=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)
def test_loggin_in_security_server_2_11_2(self): main = MainController(self) # Set test name and number main.test_number = '2.11.2' main.test_name = self.__class__.__name__ main.url = main.config.get('cs.host') main.username = main.config.get('cs.user') main.password = main.config.get('cs.pass') if main.driver is None: main.reset_webdriver(main.url, username=main.username, password=main.password, init_new_webdriver=False) groups = '{0},{1}'.format( main.config.get('xroad.registration_officer_group'), main.config.get('xroad.service_administrator_group')) main.xroad_audit_log = LOG_FILE_LOCATION users = { 'user1': { 'username': main.config.get('xroad.user1'), 'password': main.config.get('xroad.user1'), 'group': groups }, 'user2': { 'username': main.config.get('xroad.user2'), 'password': main.config.get('xroad.user2'), 'group': groups }, 'user3': { 'username': main.config.get('xroad.user3'), 'password': main.config.get('xroad.user3'), 'group': groups } } client_id = main.config.get('ss1.client2_id') client_name = main.config.get('ss1.client2_name') wsdl_url = main.config.get('wsdl.remote_path').format( main.config.get('wsdl.service_wsdl')) main.driver.get(main.url) main.login(main.username, main.password) main.log('TEST: LOGGING TEST IN SECURITY SERVER') test_func = logging_service_ss_2_11_2.test_test( ssh_host=main.config.get('ss1.ssh_host'), ssh_username=main.config.get('ss1.ssh_user'), ssh_password=main.config.get('ss1.ssh_pass'), cs_host=main.config.get('cs.host'), cs_username=main.config.get('cs.user'), cs_password=main.config.get('cs.pass'), sec_host=main.config.get('ss1.host'), sec_username=main.config.get('ss1.user'), sec_password=main.config.get('ss1.pass'), users=users, client_id=client_id, client_name=client_name, wsdl_url=wsdl_url) test_func(main) 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_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()