Merge "Merge network clients to a single class"
diff --git a/tempest/services/object_storage/account_client.py b/tempest/services/object_storage/account_client.py
index a2044ef..23984cd 100644
--- a/tempest/services/object_storage/account_client.py
+++ b/tempest/services/object_storage/account_client.py
@@ -18,17 +18,14 @@
 from xml.etree import ElementTree as etree
 
 from tempest.common import http
-from tempest.common import rest_client
 from tempest import config
 from tempest import exceptions
+from tempest.services.object_storage import base
 
 CONF = config.CONF
 
 
-class AccountClient(rest_client.RestClient):
-    def __init__(self, auth_provider):
-        super(AccountClient, self).__init__(auth_provider)
-        self.service = CONF.object_storage.catalog_type
+class AccountClient(base.ObjectStorageClient):
 
     def create_account(self, data=None,
                        params=None,
@@ -167,17 +164,10 @@
         return resp, body
 
 
-class AccountClientCustomizedHeader(rest_client.RestClient):
+class AccountClientCustomizedHeader(base.ObjectStorageClient):
 
     # TODO(andreaf) This class is now redundant, to be removed in next patch
 
-    def __init__(self, auth_provider):
-        super(AccountClientCustomizedHeader, self).__init__(
-            auth_provider)
-        # Overwrites json-specific header encoding in rest_client.RestClient
-        self.service = CONF.object_storage.catalog_type
-        self.format = 'json'
-
     def request(self, method, url, extra_headers=False, headers=None,
                 body=None):
         """A simple HTTP request interface."""
diff --git a/tempest/services/object_storage/base.py b/tempest/services/object_storage/base.py
new file mode 100644
index 0000000..c903ca5
--- /dev/null
+++ b/tempest/services/object_storage/base.py
@@ -0,0 +1,29 @@
+# Copyright 2014 NEC Corporation.  All rights reserved.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
+#    not use this file except in compliance with the License. You may obtain
+#    a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+#    License for the specific language governing permissions and limitations
+#    under the License.
+
+from tempest.common import rest_client
+from tempest import config
+
+CONF = config.CONF
+
+
+class ObjectStorageClient(rest_client.RestClient):
+    """
+    Base object storage client class
+    """
+
+    def __init__(self, auth_provider):
+        super(ObjectStorageClient, self).__init__(auth_provider)
+        self.service = CONF.object_storage.catalog_type
+        self.format = 'json'
diff --git a/tempest/services/object_storage/container_client.py b/tempest/services/object_storage/container_client.py
index 182c4d0..c55826b 100644
--- a/tempest/services/object_storage/container_client.py
+++ b/tempest/services/object_storage/container_client.py
@@ -17,20 +17,10 @@
 import urllib
 from xml.etree import ElementTree as etree
 
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
+from tempest.services.object_storage import base
 
 
-class ContainerClient(rest_client.RestClient):
-    def __init__(self, auth_provider):
-        super(ContainerClient, self).__init__(auth_provider)
-
-        # Overwrites json-specific header encoding in rest_client.RestClient
-        self.headers = {}
-        self.service = CONF.object_storage.catalog_type
-        self.format = 'json'
+class ContainerClient(base.ObjectStorageClient):
 
     def create_container(
             self, container_name,
diff --git a/tempest/services/object_storage/object_client.py b/tempest/services/object_storage/object_client.py
index 7a69fa8..a93a9df 100644
--- a/tempest/services/object_storage/object_client.py
+++ b/tempest/services/object_storage/object_client.py
@@ -18,18 +18,14 @@
 import urlparse
 
 from tempest.common import http
-from tempest.common import rest_client
 from tempest import config
 from tempest import exceptions
+from tempest.services.object_storage import base
 
 CONF = config.CONF
 
 
-class ObjectClient(rest_client.RestClient):
-    def __init__(self, auth_provider):
-        super(ObjectClient, self).__init__(auth_provider)
-
-        self.service = CONF.object_storage.catalog_type
+class ObjectClient(base.ObjectStorageClient):
 
     def create_object(self, container, object_name, data,
                       params=None, metadata=None):
@@ -182,17 +178,10 @@
         return resp.status, resp.reason, resp_headers
 
 
-class ObjectClientCustomizedHeader(rest_client.RestClient):
+class ObjectClientCustomizedHeader(base.ObjectStorageClient):
 
     # TODO(andreaf) This class is now redundant, to be removed in next patch
 
-    def __init__(self, auth_provider):
-        super(ObjectClientCustomizedHeader, self).__init__(
-            auth_provider)
-        # Overwrites json-specific header encoding in rest_client.RestClient
-        self.service = CONF.object_storage.catalog_type
-        self.format = 'json'
-
     def request(self, method, url, extra_headers=False, headers=None,
                 body=None):
         """A simple HTTP request interface."""