def test():

    com = Common()

    print('------- start the test -------')
    
    data = com.sm_retrieve_get_test_list(1)

    for n, row in data.items():
        lims_id = row['lims_id']
        serial_number = row['serial_number']

        if serial_number[1:3] == '41':
            print('------- using SM User interface to cancel assay: LIMS_ID {} serial num {}'.format(lims_id, serial_number))

            com.sm_retrieve_cancel_test_by_serial_number_or_lims_id(
                sm_number=1,
                by="serial_number",
                serial_number_or_lims_id=serial_number,
                test_comment=com.get_random_approve_comment(),
                oos_comment=com.get_random_approve_comment(),
                general_comment=com.get_random_approve_comment(),
                mold_count=com.get_random_approve_mold_count())

    print('------- test is done -------')
예제 #2
0
def test():

    com = Common()

    print('------- start the test -------')

    data = com.sm_retrieve_get_test_list(1)

    # the test checks to confirm at least one "40" and one "41" assay
    # these are presumed started by earlier tests
    found40 = False
    found41 = False
    for n, row in data.items():
        lims_id = row['lims_id']
        serial_number = row['serial_number']
        if lims_id[0:2] == '40':
            found40 = True
            print('------- found LIMS_ID {} serial number {}'.format(
                lims_id, serial_number))
        if lims_id[0:2] == '41':
            found41 = True
            print('------- found LIMS_ID {} serial number {}'.format(
                lims_id, serial_number))

    assert found40, 'the test was expecting an assay with LIMS_ID 40xxxxxx and did not find it'
    assert found41, 'the test was expecting an assay with LIMS_ID 41xxxxxx and did not find it'

    print('------- test is done -------')
예제 #3
0
def test():

    com = Common()

    print('------- get the token -------')

    token = com.get_auth_token()

    print('------- create the LIMS cancel request -------')

    data = com.sm_retrieve_get_test_list(1)

    for n, row in data.items():
        lims_id = row['lims_id']
        serial_number = row['serial_number']

        if lims_id[0:2] == '42':
            print('------- using LIMS Cancel command to cancel assay: LIMS_ID {} serial num {}'.format(lims_id, serial_number))

            method = 'POST'
            url = com.get_cm_ip() + 'lims/postCancel'
    
            headers = {
                'accept': 'application/json',
                'Content-Type': 'application/json',
                'Authorization': token,
                }

            fields = {}

            body_raw = {
                "instr_id": com.get_sm_inst_id(1),
                "lims_id": lims_id,
                "serial_number": '',
                "sample_id": '',
                "lot_batch_id": '',
                }

            body_encoded = json.dumps(body_raw).encode('utf-8')

            print('------- issue the LIMS cancel request to CM -------')
            r = com.http.request(
                method=method,
                url=url,
                headers=headers,
                fields=fields,
                body=body_encoded,
                retries=False,
                timeout=120.0)

            print('------- response from CM is here -------')
            assert r.status == 200, "response has bad status"

            print('------- test done --------')













    print('------- test is done -------')