Ejemplo n.º 1
0
def test_get_methods(ws):
    name = 'Method 1'
    desc = 'Placeholder description.'
    models.add_method(name, desc)
    rsp = decode_json_string(ws.get('/methods').data)
    assert [{'id':'XZOQ0-method-1', 'name':name, 'description':desc}] \
        == rsp
Ejemplo n.º 2
0
def test_get_methods(ws):
    name = 'Method 1'
    desc = 'Placeholder description.'
    models.add_method(name, desc)
    rsp = decode_json_string(ws.get('/methods').data)
    assert [{'id':'XZOQ0-method-1', 'name':name, 'description':desc}] \
        == rsp
Ejemplo n.º 3
0
def test_get_stages(ws, sample_with_stages):
    rsp = decode_json_string(ws.get('/projects/PqrX9/samples/OQn6Q/stages').data)
    assert {'sample'  : 'OQn6Q',
            'token'   : 'kyDbw',
            'stages'  : [{'id'         : 'Drn1Q-1',
                          'method'     : 'XZOQ0-x-ray-tomography',
                          'sample'     : 'OQn6Q-sample-1',
                          'alt-id'     : None,
                          'annotation' : 'Annotation 0'},
                         {'id'         : 'bQ8bm-2',
                          'method'     : 'XZOQ0-x-ray-tomography',
                          'sample'     : 'OQn6Q-sample-1',
                          'alt-id'     : None,
                          'annotation' : 'Annotation 1'}]} \
        == rsp
Ejemplo n.º 4
0
def test_get_stages(ws, sample_with_stages):
    rsp = decode_json_string(
        ws.get('/projects/PqrX9/samples/OQn6Q/stages').data)
    assert {'sample'  : 'OQn6Q',
            'token'   : 'kyDbw',
            'stages'  : [{'id'         : 'Drn1Q-1',
                          'method'     : 'XZOQ0-x-ray-tomography',
                          'sample'     : 'OQn6Q-sample-1',
                          'alt-id'     : None,
                          'annotation' : 'Annotation 0'},
                         {'id'         : 'bQ8bm-2',
                          'method'     : 'XZOQ0-x-ray-tomography',
                          'sample'     : 'OQn6Q-sample-1',
                          'alt-id'     : None,
                          'annotation' : 'Annotation 1'}]} \
        == rsp
Ejemplo n.º 5
0
def test_no_projects(ws):
    rsp = ws.get('/projects')
    assert [] == decode_json_string(rsp.data)
Ejemplo n.º 6
0
def test_sample_project_not_found(ws, sample):
    rsp = ws.get('/projects/00000-project-X/samples')
    assert http.HTTP_404_NOT_FOUND == rsp.status_code
Ejemplo n.º 7
0
def test_sample_not_found(ws, sample):
    rsp = ws.get('projects/5QMVv/samples/invalid-sample')
    assert http.HTTP_404_NOT_FOUND == rsp.status_code
Ejemplo n.º 8
0
def test_method_not_found(ws, sample_with_stages):
    rsp = ws.get('/methods/invalid-method')
    assert 404 == rsp.status_code
Ejemplo n.º 9
0
def test_get_sample_without_context(ws, sample):
    rsp = decode_json_string(ws.get('/projects/PqrX9/samples').data)
    assert [{'id'      : 'OQn6Q-sample-1',
             'name'    : 'sample 1',
             'project' : 'PqrX9-manhattan'}] \
        == rsp
Ejemplo n.º 10
0
def test_1_projects(ws, sample):
    rsp = decode_json_string(ws.get('/projects').data)
    assert [{'id':'PqrX9-manhattan',
             'name': 'Manhattan',
             'sample-mask': 'man-###'}] \
        == rsp
Ejemplo n.º 11
0
def test_get_project_without_context(ws, sample):
    rsp = decode_json_string(ws.get('/projects/PqrX9').data)
    assert {'id':'PqrX9-manhattan',
             'name': 'Manhattan',
             'sample-mask': 'man-###'} \
        == rsp
Ejemplo n.º 12
0
def test_1_projects(ws, sample):
    rsp = decode_json_string(ws.get('/projects').data)
    assert [{'id':'PqrX9-manhattan',
             'name': 'Manhattan',
             'sample-mask': 'man-###'}] \
        == rsp
Ejemplo n.º 13
0
def test_method_not_found(ws, sample_with_stages):
    rsp = ws.get('/methods/invalid-method')
    assert 404 == rsp.status_code
Ejemplo n.º 14
0
def test_get_sample(ws, sample_with_stages):
    rsp = decode_json_string(ws.get('/projects/PqrX9/samples/OQn6Q').data)
    assert {'id'      : 'OQn6Q-sample-1',
            'name'    : 'sample 1',
            'project' : 'PqrX9-manhattan'} \
            == rsp
Ejemplo n.º 15
0
def test_get_sample(ws, sample_with_stages):
    rsp = decode_json_string(ws.get('/projects/PqrX9/samples/OQn6Q').data)
    assert {'id'      : 'OQn6Q-sample-1',
            'name'    : 'sample 1',
            'project' : 'PqrX9-manhattan'} \
            == rsp
Ejemplo n.º 16
0
def test_no_projects(ws):
    rsp = ws.get('/projects')
    assert [] == decode_json_string(rsp.data)
Ejemplo n.º 17
0
def test_sample_not_found(ws, sample):
    rsp = ws.get('projects/5QMVv/samples/invalid-sample')
    assert http.HTTP_404_NOT_FOUND == rsp.status_code
Ejemplo n.º 18
0
def test_sample_project_not_found(ws, sample):
    rsp = ws.get('/projects/00000-project-X/samples')
    assert http.HTTP_404_NOT_FOUND == rsp.status_code
Ejemplo n.º 19
0
def test_get_sample_without_context(ws, sample):
    rsp = decode_json_string(ws.get('/projects/PqrX9/samples').data)
    assert [{'id'      : 'OQn6Q-sample-1',
             'name'    : 'sample 1',
             'project' : 'PqrX9-manhattan'}] \
        == rsp
Ejemplo n.º 20
0
def test_get_project_without_context(ws, sample):
    rsp = decode_json_string(ws.get('/projects/PqrX9').data)
    assert {'id':'PqrX9-manhattan',
             'name': 'Manhattan',
             'sample-mask': 'man-###'} \
        == rsp
Ejemplo n.º 21
0
def test_get_method(ws, sample_with_stages):
    rsp = decode_json_string(ws.get('/methods/XZOQ0-x-ray-tomography').data)
    assert {'id'          : 'XZOQ0-x-ray-tomography',
            'name'        : 'X-ray tomography',
            'description' : 'Placeholder description.'} \
            == rsp
Ejemplo n.º 22
0
def test_get_method(ws, sample_with_stages):
    rsp = decode_json_string(ws.get('/methods/XZOQ0-x-ray-tomography').data)
    assert {'id'          : 'XZOQ0-x-ray-tomography',
            'name'        : 'X-ray tomography',
            'description' : 'Placeholder description.'} \
            == rsp