Exemplo n.º 1
0
 def test_timeout_reset_after_call(self):
     old_timeout = socket.getdefaulttimeout()
     self.stub_urlopen_with_timeout_check(30, None, "url")
     try:
         socket.setdefaulttimeout(1234)
         base_utils.urlopen("url", timeout=30)
         self.assertEquals(1234, socket.getdefaulttimeout())
     finally:
         socket.setdefaulttimeout(old_timeout)
Exemplo n.º 2
0
 def test_args_are_untouched(self):
     self.stub_urlopen_with_timeout_check(30, None, "http://url",
                                          "POST data")
     base_utils.urlopen("http://url", timeout=30, data="POST data")
Exemplo n.º 3
0
 def test_timeout_set_by_default(self):
     def test_func(timeout):
         self.assertTrue(timeout is not None)
     self.stub_urlopen_with_timeout_comparison(test_func, None, "url")
     base_utils.urlopen("url")
Exemplo n.º 4
0
 def test_timeout_set_during_call(self):
     self.stub_urlopen_with_timeout_check(30, "retval", "url")
     retval = base_utils.urlopen("url", timeout=30)
     self.assertEquals(retval, "retval")