Example #1
0
def test_generate_content_not_existence_resource():
    with patch.multiple('http.helpers.content_generator',
            exists=DEFAULT, isdir=DEFAULT, handle_file=DEFAULT) as values:
        exists_mock = values['exists']
        isdir_mock = values['isdir']
        handle_file_mock = values['handle_file']
        exists_mock.return_value = True
        isdir_mock.return_value = False

        handle_path('/server/avatar.jpg', 1, 2)

        isdir_mock.assert_called_once_with('server/avatar.jpg')
        handle_file_mock.assert_called_once_with('server/avatar.jpg')
Example #2
0
def test_generate_content_not_existence_resource(exists_mock):
    exists_mock.return_value = False
    with pytest.raises(NotFoundHttpException):
        handle_path('/server/avatar.jpg')
    exists_mock.assert_called_once_with('server/avatar.jpg')
Example #3
0
def server_show(request, response):
    path = request.path[1:]
    return handle_path(path, request, response)
def server_show(request, response):
    path = request.path[1:]
    return handle_path(path, request, response)