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()
Ejemplo n.º 2
0
    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()
Ejemplo n.º 3
0
    def test_case(self):
        # TEST PLAN 2.11.1 logging maintenance actions in central server
        self.log('*** 2.11.1 / XT-518')

        # Save users to MainController
        self.users = users

        # Get the first user
        user = users['user1']

        # Extract client parameters from ID, save names
        client = xroad.split_xroad_subsystem(client_id)
        client['name'] = client_name
        client['name2'] = client_name2

        # Create SSH session
        ssh_client = ssh_server_actions.get_client(ssh_host, ssh_username,
                                                   ssh_password)
        self.log('Adding users to system')

        # Add test users to the system so the test can be run separately from others
        add_users_to_system(self, ssh_client)

        # By default, there is no error.
        error = False

        try:
            # TEST PLAN 2.11.1-1 log in to central server UI as user1
            self.log('2.11.1-1 logging in to central server as user1')
            check_login(self, ssh_client, None, users['user1'])

            # TEST PLAN 2.11.1-2 adding new member to central server
            self.log('2.11.1-2 adding new member to central server')
            add_member_to_cs(self, ssh_client, user, member=client)

            # TEST PLAN 2.11.1-3 adding new subsystem to the member
            self.log('2.11.1-3 adding new subsystem to the member')
            add_subsystem_to_member(self, ssh_client, user, member=client)

            # TEST PLAN 2.11.1-4, 2.11.1-5 change member name (empty and non-empty)
            self.log(
                '2.11.1-4, 2.11.1-5 change member name (empty and non-empty)')
            change_member_name(self, ssh_client, user, member=client)

            # TEST PLAN 2.11.1-6 log out and then log in to central server UI as user2
            self.log('2.11.1-6 logging out, then logging in as user2')
            user = users['user2']
            check_login(self,
                        ssh_client,
                        logout_user=users['user1'],
                        login_user=user)

            # TEST PLAN 2.11.1-7, 2.11.1-8 add new group (failure and success test)
            self.log(
                '2.11.1-7, 2.11.1-8 add new group (failure and success test)')
            add_group(self, ssh_client, user, group)

            # TEST PLAN 2.11.1-9 add the new subsystem to the new group
            self.log('2.11.1-9 add the subsystem to the new group')
            add_client_to_group(self,
                                ssh_client,
                                user,
                                member=client,
                                group=group)

            # TEST PLAN 2.11.1-10 add new registration request for the new subsystem
            self.log(
                '2.11.1-10 add new registration request for the new subsystem')
            self.driver.get(self.url)
            register_subsystem_to_security_server(self,
                                                  ssh_client,
                                                  user,
                                                  member=client,
                                                  server_id=server_id)

            # TEST PLAN 2.11.1-11 log out, then log in to central server as user3
            self.log(
                '2.11.1-11 log out, then log in to central server as user3')
            user = users['user3']
            check_login(self,
                        ssh_client,
                        logout_user=users['user2'],
                        login_user=user)

            # TEST PLAN 2.11.1-12 remove the registration request for the new subsystem
            self.log(
                '2.11.1-12 remove the registration request for the new subsystem'
            )
            remove_subsystem_registration_request(self, ssh_client, user,
                                                  server_id)

            # TEST PLAN 2.11.1-13 delete the member from central server
            self.log('2.11.1-13 delete the member from central server')
            delete_client(self, ssh_client, user, member=client)

            # TEST PLAN 2.11.1-14 checks are done in the corresponding functions.
        except:
            # Had an error, set error to be True and print traceback.
            traceback.print_exc()
            error = True
        finally:
            # Always remove data
            try:
                # Remove test data that may have been partially created on error
                if error:
                    # Remove member
                    try:
                        self.log('2.11.1-del remove member')
                        delete_client(self, ssh_client, user, member=client)
                    except:
                        self.log('2.11.1-del removing member failed')

                    # Revoke all requests (loop until done)
                    try:
                        self.log('2.11.1-del revoking requests')
                        self.reset_webdriver(self.config.get('cs.host'),
                                             self.config.get('cs.user'),
                                             self.config.get('cs.pass'))
                        self.wait_jquery()
                        self.wait_until_visible(
                            type=By.CSS_SELECTOR,
                            element=sidebar.MANAGEMENT_REQUESTS_CSS).click()
                        self.wait_jquery()
                        time.sleep(5)

                        try:
                            td = self.by_xpath(
                                members_table.get_requests_row_by_td_text(
                                    'SUBMITTED FOR APPROVAL'))
                        except:
                            td = None

                        try:
                            while td is not None:
                                td.click()
                                self.wait_until_visible(
                                    type=By.ID,
                                    element=members_table.
                                    MANAGEMENT_REQUEST_DETAILS_BTN_ID).click()
                                self.wait_jquery()
                                time.sleep(1)
                                self.log('2.11.1-del revoking request')
                                self.wait_until_visible(
                                    type=By.XPATH,
                                    element=members_table.
                                    DECLINE_REQUEST_BTN_XPATH).click()
                                self.wait_jquery()
                                popups.confirm_dialog_click(self)
                                time.sleep(5)
                                try:
                                    td = self.by_xpath(
                                        members_table.
                                        get_requests_row_by_td_text(
                                            'SUBMITTED FOR APPROVAL'))
                                except:
                                    td = None
                        except:
                            traceback.print_exc()

                    except:
                        self.log('2.11.1-del Deleting client failed')
            except:
                self.log('2.11.1-del Deleting client failed')
            try:
                self.log('2.11.1-del Deleting group')
                remove_group(self, group)
            except:
                self.log('2.11.1-del Deleting group failed')
            self.log('2.11.1-del closing SSH connection')
            ssh_client.close()
            if error:
                # Got an error before, fail the test
                assert False, '2.11.1 failed'
Ejemplo n.º 4
0
    def test_case(self):
        # TEST PLAN 2.9.1 changing database rows with interface, central server
        self.log('*** 2.9.1 / XT-509')

        error = False
        client = xroad.split_xroad_subsystem(client_id)
        client['name'] = client_name
        client['name2'] = client_name2
        self.users = users

        try:
            # TEST PLAN 2.9.1-1, 2.9.1-2 add new users to system and set them to be registration officers
            self.log('2.9.1-1, 2.9.1-2 add new users to system and set them to be registration officers')
            add_users_to_system(self, ssh_host, ssh_username, ssh_password)

            # Users actions and saving times

            before_created_at = ssh_server_actions.get_server_time(ssh_host, ssh_username, ssh_password)

            # TEST PLAN 2.9.1-3, 2.9.1-4 log in with user1, add new member
            self.log('2.9.1-3, 2.9.1-4 log in with user1, add new member')
            user_1_actions(self, client)
            after_created_at = ssh_server_actions.get_server_time(ssh_host, ssh_username, ssh_password)

            # TEST PLAN 2.9.1-5, 2.9.1-6 log in with user2, edit member
            self.log('2.9.1-5, 2.9.1-6 log in with user2, edit member')
            user_2_actions(self, client)
            after_edited_at = ssh_server_actions.get_server_time(ssh_host, ssh_username, ssh_password)

            # TEST PLAN 2.9.1-7, 2.9.1-8 log in with user3, delete member
            self.log('2.9.1-7, 2.9.1-8 log in with user3, delete member')
            user_3_actions(self, client)
            after_deleted_at = ssh_server_actions.get_server_time(ssh_host, ssh_username, ssh_password)

            # TEST PLAN 2.9.1-9 connect to database and check for user action rows
            self.log('2.9.1-9 connect to database and check for user action rows')
            client = get_client(ssh_host, users['databaseuser'][USERNAME], users['databaseuser'][PASSWORD])
            output = []

            try:
                output, out_error = ssh_server_actions.get_history_for_user(client, users['databaseuser'][USERNAME],
                                                                            users['databaseuser']['db_name'],
                                                                            users['user1'][USERNAME], 2)

                for data in get_formatted_data(output):
                    self.is_true(before_created_at <= datetime.datetime.strptime(data['timestamp'],
                                                                                 "%Y-%m-%d %H:%M:%S.%f") <= after_created_at,
                                 test_name, '2.9.1-9 Error: database rows have not been changed for user1',
                                 '2.9.1-9 testing if database rows have been changed for user1'
                                 )

                output, out_error = ssh_server_actions.get_history_for_user(client, users['databaseuser'][USERNAME],
                                                                            users['databaseuser']['db_name'],
                                                                            users['user2'][USERNAME], 2)
                for data in get_formatted_data(output):
                    self.is_true(after_created_at <= datetime.datetime.strptime(data['timestamp'],
                                                                                "%Y-%m-%d %H:%M:%S.%f") <= after_edited_at,
                                 test_name, '2.9.1-9 Error: database rows have not been changed for user2',
                                 '2.9.1-9 testing if database rows have been changed for user2'
                                 )

                output, out_error = ssh_server_actions.get_history_for_user(client, users['databaseuser'][USERNAME],
                                                                            users['databaseuser']['db_name'],
                                                                            users['user3'][USERNAME], 3)
                for data in get_formatted_data(output):
                    self.is_true(after_edited_at <= datetime.datetime.strptime(data['timestamp'],
                                                                               "%Y-%m-%d %H:%M:%S.%f") <= after_deleted_at,
                                 test_name, '2.9.1-9 Error: database rows have not been changed for user3',
                                 '2.9.1-9 testing if database rows have been changed for user3'
                                 )

            except:
                # Exception - don't fail but remember it
                self.log('2.9.1 Could not parse string {0}, {1}'.format(output, out_error))
                error = True
            finally:
                # Close SSH connection and, if error, print traceback
                self.log('2.9.1 Closing SSH client')
                client.close()
                if error:
                    traceback.print_exc()
                    assert False, '2.9.1 failed'

        except:
            # Got an exception, reset everything
            traceback.print_exc()
            remove_added_data(self, client)
        finally:
            # Always remove the users
            remove_users_from_system(self, ssh_host, ssh_username, ssh_password)
Ejemplo n.º 5
0
def add_services_to_client(self, ssh_host, ssh_username, ssh_password,
                           sec_host, sec_username, sec_password, users, client,
                           wsdl_url):
    # TEST PLAN 2.11.2-8 logout user2 and login as user3
    self.log('2.11.2-8 logout user2 and login as user3')
    self.logout(sec_host)
    # TEST PLAN 2.11.2-14 logout logging check
    bool_value, log_data, date_time = check_logs_for(self, ssh_host,
                                                     ssh_username,
                                                     ssh_password, LOGOUT,
                                                     users['user2'][USERNAME])
    self.is_true(bool_value, test_name,
                 '2.11.2-8/2.11.2-14 logout logging check - check failed',
                 '2.11.2-8/2.11.2-14 logout logging check')

    # Login as user3
    self.login(username=sec_username, password=sec_password)
    # TEST PLAN 2.11.2-14 login logging check
    bool_value, log_data, date_time = check_logs_for(self, ssh_host,
                                                     ssh_username,
                                                     ssh_password, LOGIN,
                                                     sec_username)
    self.is_true(bool_value, test_name,
                 '2.11.2-8/2.11.2-14 login logging check - check failed',
                 '2.11.2-8/2.11.2-14 login logging check')
    # TEST PLAN 2.11.2-9 trying to add invalid WSDL to client
    self.log('2.11.2-9 trying to add invalid WSDL to client')
    self.wait_jquery()
    added_client_row(self=self, client=client).find_element_by_css_selector(
        clients_table.SERVICES_TAB_CSS).click()
    self.wait_until_visible(
        type=By.ID,
        element=popups.CLIENT_DETAILS_POPUP_ADD_WSDL_BTN_ID).click()
    wsdl_area = self.wait_until_visible(type=By.ID,
                                        element=popups.ADD_WSDL_POPUP_URL_ID)
    self.input(wsdl_area,
               self.config.get('wsdl.remote_path').format(
                   ''))  # URL that does not return a WSDL file
    self.wait_until_visible(
        type=By.XPATH, element=popups.ADD_WSDL_POPUP_OK_BTN_XPATH).click()
    self.wait_jquery()

    # TEST PLAN 2.11.2-14 log check for trying to add invalid WSDL
    bool_value, log_data, date_time = check_logs_for(self, ssh_host,
                                                     ssh_username,
                                                     ssh_password,
                                                     ADD_WSDL_FAILED,
                                                     sec_username)
    self.is_true(
        bool_value, test_name,
        '2.11.2-9/2.11.2-14 log check for trying to add invalid WSDL - check failed',
        '2.11.2-9/2.11.2-14 log check for trying to add invalid WSDL')

    # TEST PLAN 2.11.2-10 trying to add correct WSDL to client
    self.log('2.11.2-10 trying to add correct WSDL to client')
    wsdl_area.clear()
    self.input(wsdl_area, wsdl_url)
    self.wait_until_visible(
        type=By.XPATH, element=popups.ADD_WSDL_POPUP_OK_BTN_XPATH).click()
    self.log('Waiting 60 seconds for changes')
    time.sleep(60)
    # TEST PLAN 2.11.2-14 log check for adding correct WSDL
    bool_value, log_data, date_time = check_logs_for(self, ssh_host,
                                                     ssh_username,
                                                     ssh_password, ADD_WSDL,
                                                     sec_username)
    self.is_true(
        bool_value, test_name,
        '2.11.2-10/2.11.2-14 log check for adding correct WSDL - check failed',
        '2.11.2-10/2.11.2-14 log check for adding correct WSDL')

    # TEST PLAN 2.11.2-11 edit service parameters
    self.log('2.11.2-11 edit service parameters')
    services_list = clients_table.client_services_popup_get_services_rows(
        self=self, wsdl_url=wsdl_url)
    services_list[0].click()
    self.log('Open edit wsdl service popup')
    self.wait_until_visible(
        type=By.ID,
        element=popups.CLIENT_DETAILS_POPUP_EDIT_WSDL_BTN_ID).click()
    self.log('Editing service parameters')
    timeout_area = self.wait_until_visible(
        type=By.ID, element=popups.EDIT_SERVICE_POPUP_TIMEOUT_ID)
    self.input(timeout_area, '55')
    self.wait_until_visible(
        type=By.XPATH, element=popups.EDIT_SERVICE_POPUP_OK_BTN_XPATH).click()
    # TEST PLAN 2.11.2-14 log check for editing service parameters
    bool_value, log_data, date_time = check_logs_for(self, ssh_host,
                                                     ssh_username,
                                                     ssh_password,
                                                     EDIT_SERVICE_PARAMS,
                                                     sec_username)
    self.is_true(
        bool_value, test_name,
        '2.11.2-11/2.11.2-14 log check for editing service parameters - check failed',
        '2.11.2-11/2.11.2-14 log check for editing service parameters')

    # TEST PLAN 2.11.2-12 set service access rights
    self.log('2.11.2-12 set service access rights')
    self.driver.get(sec_host)

    client_to_add = {
        'instance': ssh_server_actions.get_server_name(self),
        'class': client['class'],
        'code': client['code'],
        'subsystem': client['subsystem']
    }
    subject = xroad.split_xroad_subsystem(self.config.get('ss1.client_id'))
    acl_subject = ' : '.join([
        subject['type'], subject['instance'], subject['class'],
        subject['code'], client['subsystem']
    ])

    add_to_acl_2_1_8.test_add_subjects(client=client_to_add,
                                       wsdl_index=0,
                                       service_index=0,
                                       service_subjects=[acl_subject],
                                       remove_data=False,
                                       allow_remove_all=True,
                                       case=self)
Ejemplo n.º 6
0
    def test_case(self):
        # TEST PLAN 2.11.2 logging maintenance actions in security server
        self.log('*** 2.11.2 / XT-519')
        error = False
        client = xroad.split_xroad_subsystem(client_id)
        client['name'] = client_name
        try:
            # TEST PLAN 2.11.2-1 adding new member to central server
            self.log('2.11.2-1 adding new member to central server')
            add_member_to_cs(self, member=client)

            # TEST PLAN 2.11.2-2 add users to Security Server with service administrator rights
            self.log(
                '2.11.2-2 add users to Security Server with service administrator rights'
            )
            add_users_to_system(ssh_host, ssh_username, ssh_password, users)

            self.log('Wait 120 seconds before continuing with security server')
            time.sleep(120)

            self.log('USER 1 ACTIONS')
            user = users['user1']

            # TEST PLAN 2.11.2-3, 2.11.2-4 log in to security server UI as user1; add new subsystem as client
            self.log(
                '2.11.2-3, 2.11.2-4 log in to security server UI as user1; add new subsystem as client'
            )
            add_client_to_ss(self=self,
                             sec_host=sec_host,
                             sec_username=user[USERNAME],
                             sec_password=user[PASSWORD],
                             ssh_host=ssh_host,
                             ssh_username=ssh_username,
                             ssh_password=ssh_password,
                             client=client)

            # TEST PLAN 2.11.2-5 add new local group to the client
            self.log('2.11.2-5 add new local group to the client')
            add_group_to_client(self=self,
                                sec_host=sec_host,
                                sec_username=user[USERNAME],
                                sec_password=user[PASSWORD],
                                ssh_host=ssh_host,
                                ssh_username=ssh_username,
                                ssh_password=ssh_password,
                                client=client)

            self.logout(sec_host)
            self.login(username=user[USERNAME], password=user[PASSWORD])
            user = users['user2']

            # TEST PLAN 2.11.2-6, 2.11.2-7 log in as user2, certify client
            self.log('2.11.2-6, 2.11.2-7 log in as user2, certify client')
            certify_client_in_ss(self, ssh_host, ssh_username, ssh_password,
                                 sec_host, user[USERNAME], user[PASSWORD],
                                 users, client)
            self.url = cs_host

            self.logout(sec_host)
            self.login(users['user2'][USERNAME], users['user2'][PASSWORD])

            # TEST PLAN 2.11.2-8, 2.11.2-9, 2.11.2-10, 2.11.2-11, 2.11.2-12 log in as user3 and add WSDL to client
            self.log(
                '2.11.2-8, 2.11.2-9, 2.11.2-10, 2.11.2-11, 2.11.2-12 add WSDL to client'
            )
            user = users['user3']
            add_services_to_client(self, ssh_host, ssh_username, ssh_password,
                                   sec_host, user[USERNAME], user[PASSWORD],
                                   users, client, wsdl_url)

            # TEST PLAN 2.11.2-13 enable WSDL
            self.log('2.11.2-13 enable WSDL')
            enable_service(self, client, wsdl_url)

            # TEST PLAN 2.11.2-14 checks are done in the corresponding functions.
        except:
            traceback.print_exc()
            error = True

        finally:
            # Remove added data
            remove_data(self=self,
                        ssh_host=ssh_host,
                        ssh_username=ssh_username,
                        ssh_password=ssh_password,
                        cs_host=cs_host,
                        cs_username=cs_username,
                        cs_password=cs_password,
                        sec_host=sec_host,
                        sec_username=sec_username,
                        sec_password=sec_password,
                        users=users,
                        client=client)
            if error:
                assert False, '2.11.2 failed'
    def test_case(self):
        # TEST PLAN 2.10.1 changing database rows with interface, security server
        self.log('*** 2.10.1 / XT-514')

        error = False
        client = xroad.split_xroad_subsystem(client_id)

        # TEST PLAN 2.10.1-1, 2.10.1-2 add new users to system and set them to be registration officers
        self.log(
            '2.10.1-1, 2.10.1-2 add new users to system and set them to be registration officers'
        )
        add_users_to_system(ssh_host, ssh_username, ssh_password, users)

        db_user = users['databaseuser'][USERNAME]
        db_name = users['databaseuser']['db_name']
        try:
            # Users actions and saving times
            before_created_at = ssh_server_actions.get_server_time(
                ssh_host, ssh_username, ssh_password)

            # TEST PLAN 2.10.1-3, 2.10.1-4 log in with user1, add new client
            self.log('2.10.1-3, 2.10.1-4 log in with user1, add new client')
            user_1_actions(self, users['user1'], client)
            after_created_at = ssh_server_actions.get_server_time(
                ssh_host, ssh_username, ssh_password)

            # TEST PLAN 2.10.1-5, 2.10.1-6 log in with user2, edit client
            self.log('2.10.1-5, 2.10.1-6 log in with user2, edit client')
            user_2_actions(self, users['user2'], client)
            after_edited_at = ssh_server_actions.get_server_time(
                ssh_host, ssh_username, ssh_password)

            # TEST PLAN 2.10.1-7, 2.10.1-8 log in with user3, delete client
            self.log('2.10.1-7, 2.10.1-8 log in with user3, delete client')
            user_3_actions(self, users['user3'], client)
            after_deleted_at = ssh_server_actions.get_server_time(
                ssh_host, ssh_username, ssh_password)

            # TEST PLAN 2.10.1-9 connect to database and check for user action rows
            self.log(
                '2.10.1-9 connect to database and check for user action rows')
            sshclient = get_client(ssh_host, users['databaseuser'][USERNAME],
                                   users['databaseuser'][PASSWORD])
            try:

                sshclient.exec_command(
                    'psql -U {0} -d {1} -c "delete from identifier where membercode like \'{2}\' and subsystemcode like \'{3}\'"'
                    .format(db_user, db_name, client['code'],
                            client['subsystem']))

                output, out_error = ssh_server_actions.get_history_for_user(
                    sshclient, db_user, db_name, users['user1'][USERNAME], 1)

                for data in get_formatted_data(output):
                    self.is_true(
                        before_created_at <= datetime.datetime.strptime(
                            data['timestamp'], "%Y-%m-%d %H:%M:%S.%f") <=
                        after_created_at, test_name,
                        'Database rows have not been changed for user1',
                        'Testing if database rows have been changed for user1')

                output, out_error = ssh_server_actions.get_history_for_user(
                    sshclient, db_user, db_name, users['user2'][USERNAME], 1)
                for data in get_formatted_data(output):
                    self.is_true(
                        after_created_at <= datetime.datetime.strptime(
                            data['timestamp'], "%Y-%m-%d %H:%M:%S.%f") <=
                        after_edited_at, test_name,
                        'Database rows have not been changed for user2',
                        'Testing if database rows have been changed for user2')

                output, out_error = ssh_server_actions.get_history_for_user(
                    sshclient, db_user, db_name, users['user3'][USERNAME], 1)
                for data in get_formatted_data(output):
                    self.is_true(
                        after_edited_at <= datetime.datetime.strptime(
                            data['timestamp'], "%Y-%m-%d %H:%M:%S.%f") <=
                        after_deleted_at, test_name,
                        'Database rows have not been changed for user3',
                        'Testing if database rows have been changed for user3')
            except:
                traceback.print_exc()
                error = True
            finally:
                if not error:
                    self.log('Closing client')
                    sshclient.close()

        except:
            traceback.print_exc()

            remove_added_data(self, users, client)
            error = True
        finally:
            if error:
                remove_users_from_system(ssh_host, ssh_username, ssh_password,
                                         users)
                assert False, '2.10.1 failed'