def test():

    nav = Navigation()
    nav.start()
    nav.setup_controls_and_dialogs()

    print('\ntest start\n')

    print('----4----')
    y = api_retrieve_ui.get_test_list(nav)
    the_key = None
    for [key, value] in y.items():
        print('{} {}'.format(key, value))
        if value['serial_number'] != "E":
            the_key = key

    print('there are {} tests waiting to be cancelled'.format(len(y)))
    assert len(y) > 0, "there are no tests to cancel!"
    assert the_key is not None, "there are no tests with a serial number!"

    print('----5----')
    serial_number = y[the_key].get('serial_number')
    print('will cancel serial number {}'.format(serial_number))

    print('----6----')
    api_retrieve_ui.cancel_test_by_serial_number_or_lims_id(
        nav=nav, by="serial_number", number_or_id=serial_number)

    print('test is done')
Example #2
0
def test():

    nav = Navigation()
    nav.start()
    nav.setup_controls_and_dialogs()

    print('\ntest start\n')

    #############################
    role_name = "test_" + datetime.now().strftime('%y%m%d%H%M%S%f')
    print('------- create role with privs alternating {}'.format(role_name))

    params_raw = {
        'name': role_name,
        'privs': {
            'methods_create': '1',
            'methods_edit': '0',
            'methods_delete': '1',
            'sys_maintenance': '0',
            'sys_service': '1',
            'sys_send_system_logs': '0'
        }
    }
    params_encoded = json.dumps(params_raw).encode('utf-8')

    api_user_roles.create_role(nav=nav, params_encoded=params_encoded)

    print('test is done')
Example #3
0
def test():

    nav = Navigation()
    nav.start()
    nav.setup_controls_and_dialogs()

    print('\ntest start\n')

    ############### create ##############
    letters = string.ascii_lowercase
    username = '******' + datetime.now().strftime('%y%m%d%H%M%S%f')
    print('create user {}'.format(username))

    params_raw = {
        'first': ''.join(random.choice(letters) for i in range(6)),
        'middle': ''.join(random.choice(letters)),
        'last': ''.join(random.choice(letters) for i in range(6)),
        'username': username,
        'email': uuid.uuid4().hex.upper()[0:6] + r'@rapidmicrobio.com',
        'password': r'BlahBlah123@',
        'phone': '123-456-7890',
        'extension': '123',
        'role_name': 'Operator',
    }
    params_encoded = json.dumps(params_raw).encode('utf-8')

    api_users.create_user(nav=nav, params_encoded=params_encoded)

    ################### get ###############################

    print('get user {}'.format(username))

    r = api_users.get_user(nav=nav, name=username)

    # check
    check_list = [
        'first',
        'middle',
        'last',
        'username',
        'email',
        # 'password',
        'phone',
        'extension',
        #'role'  not implemented
    ]

    for p in check_list:
        print('check {}'.format(p))
        assert (params_raw[p] == r[p]), (
            'fails on {} expected {} observed {}'.format(
                p, params_raw[p], r[p]))

    print('test is done')
def test():

    nav = Navigation()
    nav.start()
    nav.setup_controls_and_dialogs()

    print('\ntest start\n')

    print('----4----')
    api_home_ui.left_load(nav)

    print('test is done')
Example #5
0
def test():

    nav = Navigation()
    nav.start()
    nav.setup_controls_and_dialogs()

    print('\ntest start\n')

    print('----4----')
    y = api_home_ui.get_test_list(nav)
    print(y)
    print('there are {} tests on the home ui {}'.format(len(y), y))

    print('test is done')
Example #6
0
def test():

    nav = Navigation()
    nav.start()
    nav.setup_controls_and_dialogs()

    print('\ntest start\n')

    print('----4----')
    y = api_retrieve_ui.get_test_list(nav)
    print(y)
    print('there are {} tests waiting to be retrieved'.format(len(y)))

    print('test is done')
def test():

    nav = Navigation()
    nav.start()
    nav.setup_controls_and_dialogs()

    print('\ntest start\n')

    r = api_users.get_list(nav=nav)

    for key, value in r.items():
        print("{} {}".format(key, value))

    print('there are {} users'.format(len(r)))
def test():

    nav = Navigation()
    nav.start()
    nav.setup_controls_and_dialogs()

    print('\ntest start\n')

    name = "Administrator"
    print('------- get role {}'.format(name))

    r = api_user_roles.get_role(nav=nav, name=name)

    print('--- the role data is --- ')
    for key, value in r.items():
        print("{} {}".format(key, value))

    print('test is done')
def test():

    nav = Navigation()
    nav.start()
    nav.setup_controls_and_dialogs()

    print('\ntest start\n')

    #############################
    role_name = "test_" + datetime.now().strftime('%y%m%d%H%M%S%f')
    print('------- create role with no privs identified {}'.format(role_name))

    params_raw = {'name': role_name, 'privs': {}}
    params_encoded = json.dumps(params_raw).encode('utf-8')

    api_user_roles.create_role(nav=nav, params_encoded=params_encoded)

    print('test is done')
def test():

    nav = Navigation()
    nav.start()
    nav.setup_controls_and_dialogs()

    print('\ntest start\n')

    name = "FieldService"
    print('------- get user {}'.format(name))

    r = api_users.get_user(
        nav=nav,
        name=name)

    print('--- the user data is --- ')
    for key, value in r.items():
        print("{} {}".format(key, value))

    print('test is done')
def test():

    nav = Navigation()
    nav.start()
    nav.setup_controls_and_dialogs()

    print('\ntest start\n')

    print('----4----')
    y = api_approve_ui.get_test_list(nav)
    the_key = None
    for [key, value] in y.items():
        print('{} {}'.format(key, value))
        if value != "":
            the_key = key
    print('there are {} tests waiting to be approved'.format(len(y)))
    assert len(y) > 0, "there are no tests to approve!"
    assert the_key is not None, "there are no tests with a serial number!"

    print('----5----')
    lims_id = y[the_key].get('lims_id')
    print('will approve lims_id {}'.format(lims_id))

    print('----6----')
    # generate random comments and mold count
    comment_max_len = 60
    test_comment_random = uuid.uuid4().hex.upper()[0:comment_max_len]
    oos_comment_random = uuid.uuid4().hex.upper()[0:comment_max_len]
    general_comment_random = uuid.uuid4().hex.upper()[0:comment_max_len]
    mold_count_random = random.randrange(2, 20, 2)

    api_approve_ui.approve_test_by_serial_number_or_lims_id(
        nav=nav,
        by='lims_id',
        number_or_id=lims_id,
        test_comment=test_comment_random,
        oos_comment=oos_comment_random,
        general_comment=general_comment_random,
        mold_count=mold_count_random)

    print('test is done')
def test():

    nav = Navigation()
    nav.start()
    nav.setup_controls_and_dialogs()

    print('\ntest start\n')

    #############################
    role_name = "test_" + datetime.now().strftime('%y%m%d%H%M%S%f')
    print('------- create role missing privs element {}'.format(role_name))

    params_raw = {
        'name': role_name,
    }
    params_encoded = json.dumps(params_raw).encode('utf-8')

    try:
        api_user_roles.create_role(nav=nav, params_encoded=params_encoded)
    except Exception as e:
        print('caught an exception (this is expected) {}'.format(e.__class__))

    print('test is done')
def test():

    nav = Navigation()
    nav.start()
    nav.setup_controls_and_dialogs()

    print('\ntest start\n')

    ############### create ##############
    letters = string.ascii_lowercase
    username = '******' + datetime.now().strftime('%y%m%d%H%M%S%f')
    print('------- create user {}'.format(username))

    params_raw = {
        'first': ''.join(random.choice(letters) for i in range(6)),
        'middle': ''.join(random.choice(letters)),
        'last': ''.join(random.choice(letters) for i in range(6)),
        'username': username,
        'email': uuid.uuid4().hex.upper()[0:6] + r'@rapidmicrobio.com',
        'password': r'FooFoo123@',
        'phone': '123-456-7890',
        'extension': '123',
        'role_name': 'Operator',
    }
    params_encoded = json.dumps(params_raw).encode('utf-8')

    api_users.create_user(nav=nav, params_encoded=params_encoded)

    ########### update #######################
    print('------- update some data in that user {}'.format(username))

    # make new content - no change to username
    params_raw = {
        'first': ''.join(random.choice(letters) for i in range(6)),
        'middle': ''.join(random.choice(letters)),
        'last': ''.join(random.choice(letters) for i in range(6)),
        'username': username,
        'email': uuid.uuid4().hex.upper()[0:6] + r'@rapidmicrobio.com',
        'password': r'BlahBlah123@',
        'phone': '234-567-8901',
        'extension': '456',
        'role_name': 'Administrator',
    }
    params_encoded = json.dumps(params_raw).encode('utf-8')

    api_users.update_user(nav=nav, params_encoded=params_encoded)

    ############## get/check ######################
    print('------- get/check details for user {}'.format(username))

    r = api_users.get_user(nav=nav, name=username)

    print('the user data is {}'.format(r))

    assert r['first'] == params_raw['first']
    assert r['middle'] == params_raw['middle']
    assert r['last'] == params_raw['last']
    assert r['username'] == params_raw['username']
    assert r['email'] == params_raw['email']
    assert r['phone'] == params_raw['phone']
    assert r['extension'] == params_raw['extension']
    #assert r['user_role'] == params_raw['role'] #zona - not implemented

    print('test is done')
Example #14
0
def test():

    nav = Navigation()
    nav.start()
    nav.setup_controls_and_dialogs()

    print('\ntest start\n')

    ######
    print('get count')
    r = api_users.get_list(nav)

    count_before_total = len(r)
    count_before_enabled = sum(value['enabled'] == 'Yes'
                               for value in r.values())
    count_before_disabled = sum(value['enabled'] == 'No'
                                for value in r.values())
    print('count_total = {} count_enabled = {} count_disabled = {}'.format(
        count_before_total, count_before_enabled, count_before_disabled))

    ######
    letters = string.ascii_lowercase
    username = '******' + datetime.now().strftime('%y%m%d%H%M%S%f')
    print('create user {}'.format(username))

    params_raw = {
        'first': ''.join(random.choice(letters) for i in range(6)),
        'middle': ''.join(random.choice(letters)),
        'last': ''.join(random.choice(letters) for i in range(6)),
        'username': username,
        'email': uuid.uuid4().hex.upper()[0:6] + r'@rapidmicrobio.com',
        'password': r'BlahBlah123@',
        'phone': '123-456-7890',
        'extension': '123',
        'role_name': 'Operator',
    }
    params_encoded = json.dumps(params_raw).encode('utf-8')

    api_users.create_user(nav=nav, params_encoded=params_encoded)

    ######
    print('get/check count after adding')
    r = api_users.get_list(nav)

    count_after_total = len(r)
    count_after_enabled = sum(value['enabled'] == 'Yes'
                              for value in r.values())
    count_after_disabled = sum(value['enabled'] == 'No'
                               for value in r.values())
    print('count_total = {} count_enabled = {} count_disabled = {}'.format(
        count_after_total, count_after_enabled, count_after_disabled))

    def check(obs, exp, desc):
        assert obs == exp, 'fails {} expected {} observed {}'.format(
            desc, exp, obs)

    check(count_after_total, count_before_total + 1,
          "after adding... count_after_total")
    check(count_after_enabled, count_before_enabled + 1,
          "after adding... count_after_enabled")
    check(count_after_disabled, count_before_disabled,
          "after adding... count_after_disabled")

    ######
    print('disable user')

    params_raw = {
        'username': username,
    }
    params_encoded = json.dumps(params_raw).encode('utf-8')

    api_users.disable_user(nav=nav, params_encoded=params_encoded)

    ######
    print('get/check user count after disabling')
    r = api_users.get_list(nav)

    count_after_total = len(r)
    count_after_enabled = sum(value['enabled'] == 'Yes'
                              for value in r.values())
    count_after_disabled = sum(value['enabled'] == 'No'
                               for value in r.values())
    print('count_total = {} count_enabled = {} count_disabled = {}'.format(
        count_after_total, count_after_enabled, count_after_disabled))

    check(count_after_total, count_before_total + 1,
          "after disabling... count_after_total")
    check(count_after_enabled, count_before_enabled,
          "after disabling... count_after_enabled")
    check(count_after_disabled, count_before_disabled + 1,
          "after disabling... count_after_disabled")

    print('test is done')
Example #15
0
def test():

    nav = Navigation()
    nav.start()
    nav.setup_controls_and_dialogs()

    print('\ntest start\n')

    ############# create #################
    role_name = "test_" + datetime.now().strftime('%y%m%d%H%M%S%f')
    print('------- create role with custom privs {}'.format(role_name))

    params_raw = {
        'name': role_name,
        'privs': {
            'methods_create': '1',
            'methods_edit': '1',
            'methods_delete': '1',
            'aa_create': '0',
            'aa_edit': '0',
            'aa_delete': '0'
        }
    }
    params_encoded = json.dumps(params_raw).encode('utf-8')

    api_user_roles.create_role(nav=nav, params_encoded=params_encoded)

    ########### update #######################
    print('------- update some privs in that role {}'.format(role_name))

    params_raw = {
        'name': role_name,
        'privs': {
            'methods_create': '1',
            'methods_edit': '0',
            # methods_delete to be unchanged
            'aa_create': '1',
            'aa_edit': '0',
            # aa_delete to be unchanged
        }
    }
    params_encoded = json.dumps(params_raw).encode('utf-8')

    api_user_roles.update_role(nav=nav, params_encoded=params_encoded)

    ############## check ######################
    print('------- check {}'.format(role_name))
    params_raw = {'name': role_name}
    params_encoded = json.dumps(params_raw).encode('utf-8')

    r = api_user_roles.get_role(nav=nav, name=role_name)

    print(r)

    assert r['methods_create'] == 1
    assert r['methods_edit'] == 0
    assert r['methods_delete'] == 1
    assert r['aa_create'] == 1
    assert r['aa_edit'] == 0
    assert r['aa_delete'] == 0

    print('test is done')
Example #16
0
def test():

    actionlogger.enable()

    nav = Navigation()
    nav.start()
    nav.setup_controls_and_dialogs()

    print('\ntest start')

    print('--------testing home ---------')

    y = nav.dialog['home'].menu()
    y.draw_outline()
    y = nav.dialog['home'].print()
    y.draw_outline()
    y = nav.dialog['home'].left_load()
    y.draw_outline()
    y = nav.dialog['home'].right_load()
    y.draw_outline()
    y = nav.dialog['home'].approve()
    y.draw_outline()
    y = nav.dialog['home'].retrieve()
    y.draw_outline()
    y = nav.dialog['home'].open_trash_bin()
    y.draw_outline()
    y = nav.dialog['home'].open_output_queue()
    y.draw_outline()
    y = nav.dialog['home'].test_list()
    y.draw_outline()

    print('--------testing approve ---------')

    y = nav.dialog['home'].approve()
    y.click()

    y = nav.dialog['approve'].home()
    y.draw_outline()
    y = nav.dialog['approve'].menu()
    y.draw_outline()
    y = nav.dialog['approve'].approve()
    y.draw_outline()
    y = nav.dialog['approve'].save()
    y.draw_outline()
    y = nav.dialog['approve'].test_list()
    y.draw_outline()
    y = nav.dialog['approve'].test_comment()
    y.draw_outline()
    y = nav.dialog['approve'].oos_comment()
    y.draw_outline()
    y = nav.dialog['approve'].general_comment()
    y.draw_outline()
    y = nav.dialog['approve'].mold_count()
    y.draw_outline()  # broken

    y = nav.dialog['approve'].home()
    y.click()

    print('--------testing retrieve---------')

    y = nav.dialog['home'].retrieve()
    y.click()

    y = nav.dialog['retrieve'].home()
    y.draw_outline()
    y = nav.dialog['retrieve'].menu()
    y.draw_outline()
    y = nav.dialog['retrieve'].cancel()
    y.draw_outline()
    y = nav.dialog['retrieve'].retrieve()
    y.draw_outline()
    y = nav.dialog['retrieve'].trash()
    y.draw_outline()
    y = nav.dialog['retrieve'].test_list()
    y.draw_outline()

    y = nav.dialog['retrieve'].home()
    y.click()

    print('--------testing user roles---------')

    y = nav.dialog['home'].menu()
    y.click()
    y = nav.dialog['menu'].user_roles()
    y.click()

    y = nav.dialog['user_roles'].home()
    y.draw_outline()
    y = nav.dialog['user_roles'].menu()
    y.draw_outline()
    y = nav.dialog['user_roles'].new()
    y.draw_outline()
    y = nav.dialog['user_roles'].edit()
    y.draw_outline()
    y = nav.dialog['user_roles'].save()
    y.draw_outline()
    y = nav.dialog['user_roles'].delete()
    y.draw_outline()
    y = nav.dialog['user_roles'].cancel()
    y.draw_outline()
    #################################
    y = nav.dialog['user_roles'].user_roles_list()
    y.draw_outline()
    #################################
    y = nav.dialog['user_roles'].methods_create()
    y.draw_outline()
    y = nav.dialog['user_roles'].methods_edit()
    y.draw_outline()
    y = nav.dialog['user_roles'].methods_delete()
    y.draw_outline()
    y = nav.dialog['user_roles'].aa_create()
    y.draw_outline()
    y = nav.dialog['user_roles'].aa_edit()
    y.draw_outline()
    y = nav.dialog['user_roles'].aa_delete()
    y.draw_outline()

    y = nav.dialog['user_roles'].home()
    y.click()

    print('--------testing users---------')

    y = nav.dialog['home'].menu()
    y.click()
    y = nav.dialog['menu'].users()
    y.click()

    y = nav.dialog['users'].home()
    y.draw_outline()
    y = nav.dialog['users'].menu()
    y.draw_outline()
    y = nav.dialog['users'].new()
    y.draw_outline()
    y = nav.dialog['users'].edit()
    y.draw_outline()
    y = nav.dialog['users'].save()
    y.draw_outline()
    y = nav.dialog['users'].cancel()
    y.draw_outline()
    y = nav.dialog['users'].disable()
    y.draw_outline()
    #################################
    y = nav.dialog['users'].users_list()
    y.draw_outline()
    #################################
    y = nav.dialog['users'].first()
    y.draw_outline()
    y = nav.dialog['users'].middle()
    y.draw_outline()
    y = nav.dialog['users'].last()
    y.draw_outline()
    y = nav.dialog['users'].username()
    y.draw_outline()
    y = nav.dialog['users'].email()
    y.draw_outline()
    y = nav.dialog['users'].password_a()
    y.draw_outline()
    y = nav.dialog['users'].phone()
    y.draw_outline()
    y = nav.dialog['users'].password_b()
    y.draw_outline()
    y = nav.dialog['users'].extension()
    y.draw_outline()
    y = nav.dialog['users'].user_role_combo_box()
    y.draw_outline()
    #y = nav.dialog['users'].  user_role_entry("Administrator")
    #y.draw_outline()

    ################################
    y = nav.dialog['users'].methods_create()
    y.draw_outline()
    y = nav.dialog['users'].methods_edit()
    y.draw_outline()
    y = nav.dialog['users'].methods_delete()
    y.draw_outline()
    y = nav.dialog['users'].aa_create()
    y.draw_outline()
    y = nav.dialog['users'].aa_edit()
    y.draw_outline()
    y = nav.dialog['users'].aa_delete()
    y.draw_outline()

    y = nav.dialog['users'].home()
    y.click()

    print('test is done')