Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_urllib2.RequestTests Class Reference

List of all members.

Public Member Functions

def setUp
def test_method
def test_add_data
def test_get_full_url
def test_selector
def test_get_type
def test_get_host
def test_get_host_unquote
def test_proxy
def test_wrapped_url
def test_url_fragment

Public Attributes

 get
 post

Detailed Description

Definition at line 1352 of file test_urllib2.py.


Member Function Documentation

Definition at line 1354 of file test_urllib2.py.

01354 
01355     def setUp(self):
01356         self.get = Request("http://www.python.org/~jeremy/")
01357         self.post = Request("http://www.python.org/~jeremy/",
01358                             "data",
01359                             headers={"X-Test": "test"})

Here is the caller graph for this function:

Definition at line 1364 of file test_urllib2.py.

01364 
01365     def test_add_data(self):
01366         self.assertFalse(self.get.has_data())
01367         self.assertEqual("GET", self.get.get_method())
01368         self.get.add_data("spam")
01369         self.assertTrue(self.get.has_data())
01370         self.assertEqual("POST", self.get.get_method())

Here is the call graph for this function:

Definition at line 1371 of file test_urllib2.py.

01371 
01372     def test_get_full_url(self):
01373         self.assertEqual("http://www.python.org/~jeremy/",
01374                          self.get.get_full_url())

Here is the call graph for this function:

Definition at line 1383 of file test_urllib2.py.

01383 
01384     def test_get_host(self):
01385         self.assertEqual("www.python.org", self.get.get_host())

Here is the call graph for this function:

Definition at line 1386 of file test_urllib2.py.

01386 
01387     def test_get_host_unquote(self):
01388         req = Request("http://www.%70ython.org/")
01389         self.assertEqual("www.python.org", req.get_host())

Here is the call graph for this function:

Definition at line 1380 of file test_urllib2.py.

01380 
01381     def test_get_type(self):
01382         self.assertEqual("http", self.get.get_type())

Here is the call graph for this function:

Definition at line 1360 of file test_urllib2.py.

01360 
01361     def test_method(self):
01362         self.assertEqual("POST", self.post.get_method())
01363         self.assertEqual("GET", self.get.get_method())

Here is the call graph for this function:

Definition at line 1390 of file test_urllib2.py.

01390 
01391     def test_proxy(self):
01392         self.assertFalse(self.get.has_proxy())
01393         self.get.set_proxy("www.perl.org", "http")
01394         self.assertTrue(self.get.has_proxy())
01395         self.assertEqual("www.python.org", self.get.get_origin_req_host())
01396         self.assertEqual("www.perl.org", self.get.get_host())

Here is the call graph for this function:

Definition at line 1375 of file test_urllib2.py.

01375 
01376     def test_selector(self):
01377         self.assertEqual("/~jeremy/", self.get.get_selector())
01378         req = Request("http://www.python.org/")
01379         self.assertEqual("/", req.get_selector())

Here is the call graph for this function:

Definition at line 1401 of file test_urllib2.py.

01401 
01402     def test_url_fragment(self):
01403         req = Request("http://www.python.org/?qs=query#fragment=true")
01404         self.assertEqual("/?qs=query", req.get_selector())
01405         req = Request("http://www.python.org/#fun=true")
01406         self.assertEqual("/", req.get_selector())
01407 
01408         # Issue 11703: geturl() omits fragment in the original URL.
01409         url = 'http://docs.python.org/library/urllib2.html#OK'
01410         req = Request(url)
01411         self.assertEqual(req.get_full_url(), url)

Here is the call graph for this function:

Definition at line 1397 of file test_urllib2.py.

01397 
01398     def test_wrapped_url(self):
01399         req = Request("<URL:http://www.python.org>")
01400         self.assertEqual("www.python.org", req.get_host())

Here is the call graph for this function:


Member Data Documentation

Definition at line 1355 of file test_urllib2.py.

Definition at line 1356 of file test_urllib2.py.


The documentation for this class was generated from the following file: