Exemplo n.º 1
0
 def test_falsey_body(self):
     target = Request('GET', '/path', body=[])
     result = target.json()
     self.assertEqual(result, {
         'method': 'GET',
         'path': '/path',
         'body': []})
Exemplo n.º 2
0
    def test_all_options(self):
        target = Request(
            'POST', '/path',
            body='the content',
            headers={'Accept': 'application/json'},
            query='term=test')

        result = target.json()
        self.assertEqual(result, {
            'method': 'POST',
            'path': '/path',
            'body': 'the content',
            'headers': {'Accept': 'application/json'},
            'query': 'term=test'})
Exemplo n.º 3
0
 def test_matcher_in_path_gets_converted(self):
     target = Request('GET', Term('\/.+', '/test-path'))
     result = target.json()
     self.assertTrue(isinstance(result['path'], dict))
Exemplo n.º 4
0
 def test_sparse(self):
     target = Request('GET', '/path')
     result = target.json()
     self.assertEqual(result, {'method': 'GET', 'path': '/path'})