예제 #1
0
 def test_connect(self):
     self.mox.StubOutWithMock(socket, 'create_connection')
     socket.create_connection(('testhost', 8025), 7).AndReturn(9)
     self.mox.ReplayAll()
     conn = HTTPConnection('testhost', 8025, True, 7)
     conn.connect()
     self.assertEqual(9, conn.sock)
예제 #2
0
 def test_connect(self):
     self.mox.StubOutWithMock(socket, 'create_connection')
     socket.create_connection(('testhost', 8025), 7).AndReturn(9)
     self.mox.ReplayAll()
     conn = HTTPConnection('testhost', 8025, True, 7)
     conn.connect()
     assert_equal(9, conn.sock)
예제 #3
0
 def test_connect(self):
     self.mox.StubOutWithMock(socket, "create_connection")
     socket.create_connection(("testhost", 8025), 7).AndReturn(9)
     self.mox.ReplayAll()
     # strict HTTPConnection became deprecated
     if six.PY2:
         conn = HTTPConnection("testhost", 8025, True, 7)
     else:
         conn = HTTPConnection("testhost", 8025, 7)
     conn.connect()
     self.assertEqual(9, conn.sock)
예제 #4
0
 def test_connect(self):
     self.mox.StubOutWithMock(socket, 'create_connection')
     socket.create_connection(('testhost', 8025), 7).AndReturn(9)
     self.mox.ReplayAll()
     # strict HTTPConnection became deprecated
     if six.PY2:
         conn = HTTPConnection('testhost', 8025, True, 7)
     else:
         conn = HTTPConnection('testhost', 8025, 7)
     conn.connect()
     self.assertEqual(9, conn.sock)
예제 #5
0
 def test_init(self):
     conn = HTTPConnection('testhost', 8025, timeout=7)
     self.assertEqual(conn._create_connection, socket.create_connection)