Example #1
0
def load_test_objects():
    # sample project: profyle
    main_project_id = uuid.uuid1().hex
    main_study_id = uuid.uuid1().hex

    test_project = {
        'id': main_project_id,
        'name': 'main_test_project',
        'description': 'mock profyle project for testing',
        'tags': ['test', 'candig'],
        'version': Version
    }

    operations.post_project(test_project)

    # sample study: pog
    test_study = {
        'id': main_study_id,
        'name': 'main_test_study',
        'parentProjectID': main_project_id,
        'description': 'mock study for testing',
        'tags': ['test', 'candig'],
        'patientList': [str(x) for x in range(30)],
        'sampleList': ['PATIENT_'+str(x) for x in range(30)]
    }

    operations.post_study(test_study)
    test_expression = load_expression(main_study_id)

    return test_project, test_study, test_expression
Example #2
0
def load_supplementary_objects():
    for pname in ['PS1', 'PS2', 'PS3']:
        project_id = str(uuid.uuid1())

        test_project = {
            'id': project_id,
            'name': pname,
            'description': 'sample project for testing',
            'tags': [pname],
            'version': Version
        }

        operations.post_project(test_project)

        load_study(project_id)
Example #3
0
def test_post_project_orm_error(test_client):
    """
    post_project
    """
    sample_project, _, _, context = test_client

    with context:
        # get id (200)
        _, code = operations.post_project({'id': 12345678910, 'name': 1})
        assert code == 500
Example #4
0
def test_post_project_conversion_error(test_client):
    """
    post_project
    """
    context = test_client[3]

    with context:
        # get id (200)
        _, code = operations.post_project({'invalidField': 123})
        assert code == 400
Example #5
0
def test_post_project_exists(test_client):
    """
    post_project
    """
    sample_project, _, _, context = test_client

    with context:
        # get id (200)
        _, code = operations.post_project({'id': sample_project['id'], 'name': 'main_test_project'})
        assert code == 405
Example #6
0
def test_post_changelog_errors(test_client):
    """
    post_change_log
    """
    context = test_client[3]

    with context:
        # post log of version that already exists
        _, code = operations.post_change_log({'version': Version, 'log': 'already exists'})
        assert code == 405

        # conversion error
        _, code = operations.post_project({'invalidField': 123})
        assert code == 400