コード例 #1
0
ファイル: server_test.py プロジェクト: hammerlab/igv-httpfs
def test_head_only_requests_summary(mock_request):
    '''Pulling an entire 300GB BAM file for a HEAD request would be bad.'''
    httpfs_url = ('http://localhost:14000/webhdfs/v1/b.txt?'
        'user.name=igv&op=getcontentsummary')
    mock_request.return_value = stubbed_get(httpfs_url)
    start_response = mock.MagicMock()
    response = server.application({
        'REQUEST_METHOD': 'HEAD',
        'PATH_INFO': '/b.txt',
        'QUERY_STRING': '',
        }, start_response)

    mock_request.assert_called_once_with(httpfs_url)
コード例 #2
0
def test_head_only_requests_summary(mock_request):
    '''Pulling an entire 300GB BAM file for a HEAD request would be bad.'''
    httpfs_url = ('http://localhost:14000/webhdfs/v1/b.txt?'
                  'user.name=igv&op=getcontentsummary')
    mock_request.return_value = stubbed_get(httpfs_url)
    start_response = mock.MagicMock()
    response = server.application(
        {
            'REQUEST_METHOD': 'HEAD',
            'PATH_INFO': '/b.txt',
            'QUERY_STRING': '',
        }, start_response)

    mock_request.assert_called_once_with(httpfs_url)
コード例 #3
0
def test_stubbed_get():
    url = 'http://localhost:14000/webhdfs/v1/b.txt?op=OPEN&user.name=igv'
    eq_(200, stubbed_get(url).status_code)
    eq_('This is b.txt', stubbed_get(url).content)

    eq_(404, stubbed_get(url.replace('b.txt', 'c.txt')).status_code)
    eq_(404, stubbed_get(url.replace('b.txt', 'c.txt')).status_code)

    partial_url = url + '&offset=5&length=4'
    eq_(200, stubbed_get(partial_url).status_code)
    eq_('is b', stubbed_get(partial_url).content)