def test_falsey_body(self): target = Request('GET', '/path', body=[]) result = target.json() self.assertEqual(result, { 'method': 'GET', 'path': '/path', 'body': []})
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'})
def test_matcher_in_path_gets_converted(self): target = Request('GET', Term('\/.+', '/test-path')) result = target.json() self.assertTrue(isinstance(result['path'], dict))
def test_sparse(self): target = Request('GET', '/path') result = target.json() self.assertEqual(result, {'method': 'GET', 'path': '/path'})