=== modified file 'lava_tool/authtoken.py'
--- lava_tool/authtoken.py	2011-06-17 13:11:50 +0000
+++ lava_tool/authtoken.py	2011-07-10 23:39:36 +0000
@@ -64,12 +64,11 @@
     def send_request(self, connection, handler, request_body):
         xmlrpclib.Transport.send_request(
             self, connection, handler, request_body)
-        auth, host = urllib.splituser(self._connection[0])
-        if auth is None:
+        if self._auth is None:
             return
-        user, token = urllib.splitpasswd(auth)
+        user, token = urllib.splitpasswd(self._auth)
         if token is None:
-            endpoint_url = '%s://%s%s' % (self._scheme, host, handler)
+            endpoint_url = '%s://%s%s' % (self._scheme, self._host, handler)
             token = self.auth_backend.get_token_for_endpoint(
                 user, endpoint_url)
             if token is None:
@@ -79,13 +78,14 @@
         connection.putheader("Authorization", "Basic " + auth)
 
     def get_host_info(self, host):
-        # We override to never send any authorization header based soley on
-        # the host; we do all that in send_request above.
+        # We override stash the auth part away and never send any
+        # authorization header based soley on the host; we do all that in
+        # send_request above.
         x509 = {}
         if isinstance(host, tuple):
             host, x509 = host
-        auth, host = urllib.splituser(host)
-        return host, None, x509
+        self._auth, self._host = urllib.splituser(host)
+        return self._host, None, x509
 
 
 class AuthenticatingTransport(

=== modified file 'lava_tool/tests/test_authtoken.py'
--- lava_tool/tests/test_authtoken.py	2011-06-17 13:26:55 +0000
+++ lava_tool/tests/test_authtoken.py	2011-07-10 23:43:30 +0000
@@ -24,6 +24,7 @@
 import StringIO
 from unittest import TestCase
 import urlparse
+import sys
 import xmlrpclib
 
 from mocker import ARGS, KWARGS, Mocker
@@ -34,6 +35,10 @@
     )
 from lava_tool.interface import LavaCommandError
 
+if sys.version_info[:2] <= (2, 6):
+    TWO_SIX = True
+else:
+    TWO_SIX = False
 
 class TestAuthenticatingServerProxy(TestCase):
 
@@ -46,11 +51,13 @@
             url, auth_backend=auth_backend)
         mocker = Mocker()
         if url.startswith('https'):
-            cls_name = 'httplib.HTTPSConnection'
-            expected_constructor_args = (expected_host, None)
+            cls_name = 'httplib.HTTPS'
+            expected_constructor_args = (expected_host, ARGS)
         else:
-            cls_name = 'httplib.HTTPConnection'
-            expected_constructor_args = (expected_host,)
+            cls_name = 'httplib.HTTP'
+            expected_constructor_args = (expected_host, ARGS)
+        if not TWO_SIX:
+            cls_name += 'Connection'
         mocked_HTTPConnection = mocker.replace(cls_name, passthrough=False)
         mocked_connection = mocked_HTTPConnection(*expected_constructor_args)
         # nospec() is required because of
@@ -58,6 +65,8 @@
         mocker.nospec()
         auth_data = []
         mocked_connection.putrequest(ARGS, KWARGS)
+        if TWO_SIX:
+            mocked_connection.send(ARGS, KWARGS)
 
         def match_header(header, *values):
             if header.lower() == 'authorization':
@@ -72,10 +81,19 @@
 
         mocked_connection.endheaders(ARGS, KWARGS)
 
-        mocked_connection.getresponse(ARGS, KWARGS)
-        s = StringIO.StringIO(xmlrpclib.dumps((1,), methodresponse=True))
-        s.status = 200
-        mocker.result(s)
+        if TWO_SIX:
+            mocked_connection.getreply(ARGS, KWARGS)
+            mocker.result((200, None, None))
+            s = StringIO.StringIO(xmlrpclib.dumps((1,), methodresponse=True))
+            mocked_connection.getfile()
+            mocker.result(s)
+            mocked_connection._conn
+            mocker.result(None)
+        else:
+            mocked_connection.getresponse(ARGS, KWARGS)
+            s = StringIO.StringIO(xmlrpclib.dumps((1,), methodresponse=True))
+            s.status = 200
+            mocker.result(s)
 
         mocked_connection.close()
         mocker.count(0, 1)

