def test_operation_encoded_get():
    q = Query(app)
    
    environ = {}
    environ['REQUEST_METHOD'] = 'GET'
    environ['QUERY_STRING'] = 'text=m%C3%B6ass'

    q.extract_query(environ)
    assert 'text' in environ['tiddlyweb.query']
    assert environ['tiddlyweb.query']['text'][0] == u'm\xf6ass'
def test_operation_simple_get():
    q = Query(app)
    
    environ = {}
    environ['REQUEST_METHOD'] = 'GET'
    environ['QUERY_STRING'] = 'text=hello'

    q.extract_query(environ)
    assert 'text' in environ['tiddlyweb.query']
    assert environ['tiddlyweb.query']['text'][0] == 'hello'
Esempio n. 3
0
def test_operation_encoded_get():
    q = Query(app)

    environ = {}
    environ['REQUEST_METHOD'] = 'GET'
    environ['QUERY_STRING'] = 'text=m%C3%B6ass'

    q.extract_query(environ)
    assert 'text' in environ['tiddlyweb.query']
    assert environ['tiddlyweb.query']['text'][0] == u'm\xf6ass'
Esempio n. 4
0
def test_operation_simple_get():
    q = Query(app)

    environ = {}
    environ['REQUEST_METHOD'] = 'GET'
    environ['QUERY_STRING'] = 'text=hello'

    q.extract_query(environ)
    assert 'text' in environ['tiddlyweb.query']
    assert environ['tiddlyweb.query']['text'][0] == 'hello'
def test_operation_simple_post():
    q = Query(app)
    post = StringIO.StringIO()
    post.write('text=m%C3%B6ass')
    post.seek(0)
    environ = {}
    environ['CONTENT_LENGTH'] = 15
    environ['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'
    environ['REQUEST_METHOD'] = 'POST'
    environ['wsgi.input'] = post
    q.extract_query(environ)
    assert 'text' in environ['tiddlyweb.query']
    assert environ['tiddlyweb.query']['text'][0] == u'm\xf6ass'
Esempio n. 6
0
def test_operation_simple_post():
    q = Query(app)
    post = StringIO.StringIO()
    post.write('text=m%C3%B6ass')
    post.seek(0)
    environ = {}
    environ['CONTENT_LENGTH'] = 15
    environ['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'
    environ['REQUEST_METHOD'] = 'POST'
    environ['wsgi.input'] = post
    q.extract_query(environ)
    assert 'text' in environ['tiddlyweb.query']
    assert environ['tiddlyweb.query']['text'][0] == u'm\xf6ass'
Esempio n. 7
0
def test_interpret_query():
    def app(environ, start_response):
        pass

    query = Query(app)
    query(environ, lambda x: x)

    assert environ['tiddlyweb.query']['hello'][0] == 'goodbye'
    assert environ['tiddlyweb.query']['barney'][0] == 'ugly'
    assert environ['tiddlyweb.query']['special'][0] == 'nice'
    assert environ['tiddlyweb.query'].get('flip', [None])[0] == None
Esempio n. 8
0
def test_interpret_query():
    environ = {
        'QUERY_STRING': 'hello=good%20bye&barney=ugly&special=nice',
        'REQUEST_METHOD': 'GET'
    }

    def app(environ, start_response):
        pass

    query = Query(app)
    query(environ, lambda x: x)

    assert environ['tiddlyweb.query']['hello'][0] == 'good bye'
    assert environ['tiddlyweb.query']['barney'][0] == 'ugly'
    assert environ['tiddlyweb.query']['special'][0] == 'nice'
    assert environ['tiddlyweb.query'].get('flip', [None])[0] is None