def test_immutable(self): """ Test that property is immutable """ req = request.from_url('a') with self.assertRaises(AttributeError): req.path = 'b'
def test_path_indexing(self): """ Test that path can be manipulated by accessing a path """ req = request.from_url('a')['b'] self.assertEqual('a/b', req.path)
def test_replace(self): """ Test getting new instance via path replace() """ r1 = request.from_url('a') r2 = r1.replace(path='b') self.assertNotEqual(r1, r2) self.assertEqual(r2.path, 'b')
def test_from_url(self): """ Test that Request can be constructed from URL """ req = request.from_url('http://|"\'@%s:[email protected]:90/abc?yes=1#boo', body='a') self.assertEqual(req, ('GET', 'a.b.c.com', '/abc', {'yes': '1'}, {}, 'a', '|"\'@%s', 's', 90, 'http'))