コード例 #1
0
def test_find_by_test_id(database, test_id):
    results = find_by_test_id(database, test_id)
    assert results is not None
    for result in results:
        assert result['id'] is not None
        assert str(result['test_id']) == test_id
        assert result["description"] is not None
        assert result['patient_id'] is not None
        assert result['test_score'] is not None
コード例 #2
0
def test_find_test_by_id(database, test_id):
    result = find_by_test_id(database, test_id)[0]
    result_id = result['id']
    result_test_id = result['test_id']
    assert str(result_test_id) == test_id
    result_description = result['description']
    result_patient_id = result['patient_id']
    result_test_score = result['test_score']

    test = find_test_by_id(database, result_id)
    assert test['id'] == result_id
    assert test['patient_id'] == result_patient_id
    assert test['description'] == result_description
    assert test['test_score'] == result_test_score
コード例 #3
0
def test_insert_test(database):
    test_id = uuid.uuid4()
    patient_id = uuid.uuid4()
    test_desc = "this is a cool test for cool testing of this cool api"
    test_score = 420

    assert insert_test(database, test_id, test_desc, patient_id,
                       test_score) is True

    results = find_by_test_id(database, test_id)
    assert results is not None
    for result in results:
        if result['test_id'] == test_id:
            assert result['patient_id'] == patient_id
            assert result['description'] == test_desc
            assert result['test_score'] == test_score
コード例 #4
0
def test_insert_many_tests(database, many_tests):

    test_id = many_tests[1]["test_id"]
    description = many_tests[1]["description"]
    patient_id = many_tests[1]["patient_id"]
    test_score = many_tests[1]["test_score"]

    num_test = len(find_all_test(database))

    num_added_test = len(many_tests)

    assert insert_many_tests(database, many_tests) is True

    new_num_test = len(find_all_test(database))

    assert new_num_test == num_test + num_added_test

    results = find_by_test_id(database, test_id)
    for result in results:
        if result['patient_id'] == patient_id:
            assert result['test_id'] == test_id
            assert result['description'] == description
            assert result['patient_id'] == patient_id
            assert result['test_score'] == test_score
コード例 #5
0
import sys
sys.path.append('database')
from database.database import get_db, insert_test, find_by_test_id
from io import BytesIO
import json
import uuid

db = get_db()

test_id = uuid.uuid4()
description = "short-term memory test"
patient_id = uuid.uuid4()

insert_test(db, test_id, description, patient_id, 100)

results = find_by_test_id(db, test_id)
for result in results:
    print(result['test_score'])