Merge "Remove AccountClientCustomizedHeader class"
diff --git a/tempest/api/object_storage/base.py b/tempest/api/object_storage/base.py
index 7fabb7d..905eb9f 100644
--- a/tempest/api/object_storage/base.py
+++ b/tempest/api/object_storage/base.py
@@ -49,7 +49,6 @@
         cls.custom_object_client = cls.os.custom_object_client
         cls.token_client = cls.os_admin.token_client
         cls.identity_admin_client = cls.os_admin.identity_client
-        cls.custom_account_client = cls.os.custom_account_client
         cls.object_client_alt = cls.os_alt.object_client
         cls.container_client_alt = cls.os_alt.container_client
         cls.identity_client_alt = cls.os_alt.identity_client
@@ -59,7 +58,6 @@
         cls.container_client.auth_provider.clear_auth()
         cls.account_client.auth_provider.clear_auth()
         cls.custom_object_client.auth_provider.clear_auth()
-        cls.custom_account_client.auth_provider.clear_auth()
         cls.object_client_alt.auth_provider.clear_auth()
         cls.container_client_alt.auth_provider.clear_auth()
 
diff --git a/tempest/api/object_storage/test_account_quotas.py b/tempest/api/object_storage/test_account_quotas.py
index e75e971..1832b37 100644
--- a/tempest/api/object_storage/test_account_quotas.py
+++ b/tempest/api/object_storage/test_account_quotas.py
@@ -43,30 +43,30 @@
     def setUp(self):
         super(AccountQuotasTest, self).setUp()
 
-        # Set the reselleradmin auth in headers for next custom_account_client
+        # Set the reselleradmin auth in headers for next account_client
         # request
-        self.custom_account_client.auth_provider.set_alt_auth_data(
+        self.account_client.auth_provider.set_alt_auth_data(
             request_part='headers',
             auth_data=self.reselleradmin_auth_data
         )
         # Set a quota of 20 bytes on the user's account before each test
         headers = {"X-Account-Meta-Quota-Bytes": "20"}
 
-        self.os.custom_account_client.request("POST", url="", headers=headers,
-                                              body="")
+        self.os.account_client.request("POST", url="", headers=headers,
+                                       body="")
 
     def tearDown(self):
-        # Set the reselleradmin auth in headers for next custom_account_client
+        # Set the reselleradmin auth in headers for next account_client
         # request
-        self.custom_account_client.auth_provider.set_alt_auth_data(
+        self.account_client.auth_provider.set_alt_auth_data(
             request_part='headers',
             auth_data=self.reselleradmin_auth_data
         )
         # remove the quota from the container
         headers = {"X-Remove-Account-Meta-Quota-Bytes": "x"}
 
-        self.os.custom_account_client.request("POST", url="", headers=headers,
-                                              body="")
+        self.os.account_client.request("POST", url="", headers=headers,
+                                       body="")
         super(AccountQuotasTest, self).tearDown()
 
     @classmethod
@@ -91,7 +91,7 @@
         """Test that the ResellerAdmin is able to modify and remove the quota
         on a user's account.
 
-        Using the custom_account client, the test modifies the quota
+        Using the account client, the test modifies the quota
         successively to:
 
         * "25": a random value different from the initial quota value.
@@ -100,15 +100,15 @@
         """
         for quota in ("25", "", "20"):
 
-            self.custom_account_client.auth_provider.set_alt_auth_data(
+            self.account_client.auth_provider.set_alt_auth_data(
                 request_part='headers',
                 auth_data=self.reselleradmin_auth_data
             )
             headers = {"X-Account-Meta-Quota-Bytes": quota}
 
-            resp, _ = self.os.custom_account_client.request("POST", url="",
-                                                            headers=headers,
-                                                            body="")
+            resp, _ = self.os.account_client.request("POST", url="",
+                                                     headers=headers,
+                                                     body="")
 
             self.assertEqual(resp["status"], "204")
             self.assertHeaders(resp, 'Account', 'POST')
diff --git a/tempest/api/object_storage/test_account_quotas_negative.py b/tempest/api/object_storage/test_account_quotas_negative.py
index 6c1fb5a..a6ea6ee 100644
--- a/tempest/api/object_storage/test_account_quotas_negative.py
+++ b/tempest/api/object_storage/test_account_quotas_negative.py
@@ -43,30 +43,30 @@
 
     def setUp(self):
         super(AccountQuotasNegativeTest, self).setUp()
-        # Set the reselleradmin auth in headers for next custom_account_client
+        # Set the reselleradmin auth in headers for next account_client
         # request
-        self.custom_account_client.auth_provider.set_alt_auth_data(
+        self.account_client.auth_provider.set_alt_auth_data(
             request_part='headers',
             auth_data=self.reselleradmin_auth_data
         )
         # Set a quota of 20 bytes on the user's account before each test
         headers = {"X-Account-Meta-Quota-Bytes": "20"}
 
-        self.os.custom_account_client.request("POST", url="", headers=headers,
-                                              body="")
+        self.os.account_client.request("POST", url="", headers=headers,
+                                       body="")
 
     def tearDown(self):
-        # Set the reselleradmin auth in headers for next custom_account_client
+        # Set the reselleradmin auth in headers for next account_client
         # request
-        self.custom_account_client.auth_provider.set_alt_auth_data(
+        self.account_client.auth_provider.set_alt_auth_data(
             request_part='headers',
             auth_data=self.reselleradmin_auth_data
         )
         # remove the quota from the container
         headers = {"X-Remove-Account-Meta-Quota-Bytes": "x"}
 
-        self.os.custom_account_client.request("POST", url="", headers=headers,
-                                              body="")
+        self.os.account_client.request("POST", url="", headers=headers,
+                                       body="")
         super(AccountQuotasNegativeTest, self).tearDown()
 
     @classmethod
diff --git a/tempest/api/object_storage/test_account_services_negative.py b/tempest/api/object_storage/test_account_services_negative.py
index e4c46e2..ef04387 100644
--- a/tempest/api/object_storage/test_account_services_negative.py
+++ b/tempest/api/object_storage/test_account_services_negative.py
@@ -34,10 +34,10 @@
         test_auth_provider.auth_data
 
         # Get fresh auth for test user and set it to next auth request for
-        # custom_account_client
+        # account_client
         delattr(test_auth_provider, 'auth_data')
         test_auth_new_data = test_auth_provider.auth_data
-        self.custom_account_client.auth_provider.set_alt_auth_data(
+        self.account_client.auth_provider.set_alt_auth_data(
             request_part='headers',
             auth_data=test_auth_new_data
         )
@@ -45,5 +45,5 @@
         params = {'format': 'json'}
         # list containers with non-authorized user token
         self.assertRaises(exceptions.Unauthorized,
-                          self.custom_account_client.list_account_containers,
+                          self.account_client.list_account_containers,
                           params=params)
diff --git a/tempest/api/object_storage/test_container_staticweb.py b/tempest/api/object_storage/test_container_staticweb.py
index 5c4e0bf..3b671d4 100644
--- a/tempest/api/object_storage/test_container_staticweb.py
+++ b/tempest/api/object_storage/test_container_staticweb.py
@@ -58,15 +58,16 @@
             self.container_name, metadata=headers)
 
         # Maintain original headers, no auth added
-        self.custom_account_client.auth_provider.set_alt_auth_data(
+        self.account_client.auth_provider.set_alt_auth_data(
             request_part='headers',
             auth_data=None
         )
 
         # test GET on http://account_url/container_name
         # we should retrieve the self.object_name file
-        resp, body = self.custom_account_client.request("GET",
-                                                        self.container_name)
+        resp, body = self.account_client.request("GET",
+                                                 self.container_name,
+                                                 headers={})
         # This request is equivalent to GET object
         self.assertHeaders(resp, 'Object', 'GET')
         self.assertEqual(body, self.object_data)
@@ -89,8 +90,9 @@
 
         # test GET on http://account_url/container_name
         # we should retrieve a listing of objects
-        resp, body = self.custom_account_client.request("GET",
-                                                        self.container_name)
+        resp, body = self.account_client.request("GET",
+                                                 self.container_name,
+                                                 headers={})
         # The target of the request is not any Swift resource. Therefore, the
         # existence of response header is checked without a custom matcher.
         self.assertIn('content-length', resp)
@@ -120,15 +122,16 @@
             self.container_name, metadata=headers)
 
         # Maintain original headers, no auth added
-        self.custom_account_client.auth_provider.set_alt_auth_data(
+        self.account_client.auth_provider.set_alt_auth_data(
             request_part='headers',
             auth_data=None
         )
 
         # test GET on http://account_url/container_name
         # we should retrieve a listing of objects
-        resp, body = self.custom_account_client.request("GET",
-                                                        self.container_name)
+        resp, body = self.account_client.request("GET",
+                                                 self.container_name,
+                                                 headers={})
         self.assertIn(self.object_name, body)
         css = '<link rel="stylesheet" type="text/css" href="listings.css" />'
         self.assertIn(css, body)
diff --git a/tempest/clients.py b/tempest/clients.py
index 99339c1..dfb2c04 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -83,8 +83,6 @@
     MessagingClientJSON
 from tempest.services.network.json.network_client import NetworkClientJSON
 from tempest.services.object_storage.account_client import AccountClient
-from tempest.services.object_storage.account_client import \
-    AccountClientCustomizedHeader
 from tempest.services.object_storage.container_client import ContainerClient
 from tempest.services.object_storage.object_client import ObjectClient
 from tempest.services.object_storage.object_client import \
@@ -179,8 +177,6 @@
         self.s3_client = botoclients.ObjectClientS3(*ec2_client_args)
         self.custom_object_client = ObjectClientCustomizedHeader(
             self.auth_provider)
-        self.custom_account_client = \
-            AccountClientCustomizedHeader(self.auth_provider)
         self.data_processing_client = DataProcessingClient(
             self.auth_provider)
 
diff --git a/tempest/services/object_storage/account_client.py b/tempest/services/object_storage/account_client.py
index 23984cd..c24bbba 100644
--- a/tempest/services/object_storage/account_client.py
+++ b/tempest/services/object_storage/account_client.py
@@ -17,9 +17,7 @@
 import urllib
 from xml.etree import ElementTree as etree
 
-from tempest.common import http
 from tempest import config
-from tempest import exceptions
 from tempest.services.object_storage import base
 
 CONF = config.CONF
@@ -162,75 +160,3 @@
         body = json.loads(body)
         self.expected_success(200, resp.status)
         return resp, body
-
-
-class AccountClientCustomizedHeader(base.ObjectStorageClient):
-
-    # TODO(andreaf) This class is now redundant, to be removed in next patch
-
-    def request(self, method, url, extra_headers=False, headers=None,
-                body=None):
-        """A simple HTTP request interface."""
-        dscv = CONF.identity.disable_ssl_certificate_validation
-        ca_certs = CONF.identity.ca_certificates_file
-        self.http_obj = http.ClosingHttp(
-            disable_ssl_certificate_validation=dscv,
-            ca_certs=ca_certs)
-        if headers is None:
-            headers = {}
-        elif extra_headers:
-            try:
-                headers.update(self.get_headers())
-            except (ValueError, TypeError):
-                headers = {}
-
-        # Authorize the request
-        req_url, req_headers, req_body = self.auth_provider.auth_request(
-            method=method, url=url, headers=headers, body=body,
-            filters=self.filters
-        )
-        # use original body
-        resp, resp_body = self.http_obj.request(req_url, method,
-                                                headers=req_headers,
-                                                body=req_body)
-        self._log_request(method, req_url, resp)
-
-        if resp.status == 401 or resp.status == 403:
-            raise exceptions.Unauthorized()
-
-        return resp, resp_body
-
-    def list_account_containers(self, params=None, metadata=None):
-        """
-        GET on the (base) storage URL
-        Given a valid X-Auth-Token, returns a list of all containers for the
-        account.
-
-        Optional Arguments:
-        limit=[integer value N]
-            Limits the number of results to at most N values
-            DEFAULT:  10,000
-
-        marker=[string value X]
-            Given string value X, return object names greater in value
-            than the specified marker.
-            DEFAULT: No Marker
-
-        format=[string value, either 'json' or 'xml']
-            Specify either json or xml to return the respective serialized
-            response.
-            DEFAULT:  Python-List returned in response body
-        """
-
-        url = '?format=%s' % self.format
-        if params:
-            url += '&%s' % urllib.urlencode(params)
-
-        headers = {}
-        if metadata:
-            for key in metadata:
-                headers[str(key)] = metadata[key]
-
-        resp, body = self.get(url, headers=headers)
-        self.expected_success(200, resp.status)
-        return resp, body