Home | History | Annotate | Download | only in tests
      1 from paste.debug.debugapp import SimpleApplication
      2 from paste.fixture import TestApp
      3 
      4 def test_fixture():
      5     app = TestApp(SimpleApplication())
      6     res = app.get('/', params={'a': ['1', '2']})
      7     assert (res.request.environ['QUERY_STRING'] ==
      8             'a=1&a=2')
      9     res = app.put('/')
     10     assert (res.request.environ['REQUEST_METHOD'] ==
     11             'PUT')
     12     res = app.delete('/')
     13     assert (res.request.environ['REQUEST_METHOD'] ==
     14             'DELETE')
     15     class FakeDict(object):
     16         def items(self):
     17             return [('a', '10'), ('a', '20')]
     18     res = app.post('/params', params=FakeDict())
     19 
     20     # test multiple cookies in one request
     21     app.cookies['one'] = 'first';
     22     app.cookies['two'] = 'second';
     23     app.cookies['three'] = '';
     24     res = app.get('/')
     25     hc = res.request.environ['HTTP_COOKIE'].split('; ');
     26     assert ('one=first' in hc)
     27     assert ('two=second' in hc)
     28     assert ('three=' in hc)
     29