libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [13/46] libcloud git commit: fix onapp tests
Date Thu, 13 Apr 2017 09:33:19 GMT
fix onapp tests


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/312a08f0
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/312a08f0
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/312a08f0

Branch: refs/heads/trunk
Commit: 312a08f01606926d4d50ea74d7effa9b775f363b
Parents: d5ff8eb
Author: Anthony Shaw <anthonyshaw@apache.org>
Authored: Tue Apr 11 14:40:51 2017 +1000
Committer: Anthony Shaw <anthonyshaw@apache.org>
Committed: Tue Apr 11 14:40:51 2017 +1000

----------------------------------------------------------------------
 libcloud/test/__init__.py                 | 11 +++++++++++
 libcloud/test/dns/test_onapp.py           |  4 ++--
 libcloud/test/secrets.py-dist             |  4 ++--
 libcloud/test/storage/test_atmos.py       |  6 +++---
 libcloud/test/storage/test_azure_blobs.py |  4 ++--
 libcloud/test/storage/test_cloudfiles.py  |  6 +++---
 libcloud/test/storage/test_oss.py         |  4 ++--
 libcloud/test/storage/test_s3.py          |  4 ++--
 8 files changed, 27 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/312a08f0/libcloud/test/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/test/__init__.py b/libcloud/test/__init__.py
index 0c6e5fc..f742cad 100644
--- a/libcloud/test/__init__.py
+++ b/libcloud/test/__init__.py
@@ -243,6 +243,17 @@ def make_response(status=200, headers={}, connection=None):
     response.headers = headers
     return Response(response, connection)
 
+
+def generate_random_data(size):
+    data = ''
+    current_size = 0
+    while current_size < size:
+        value = str(random.randint(0, 9))
+        value_size = len(value)
+        data += value
+        current_size += value_size
+    return data
+
 if __name__ == "__main__":
     import doctest
     doctest.testmod()

http://git-wip-us.apache.org/repos/asf/libcloud/blob/312a08f0/libcloud/test/dns/test_onapp.py
----------------------------------------------------------------------
diff --git a/libcloud/test/dns/test_onapp.py b/libcloud/test/dns/test_onapp.py
index 7af52ba..7208b84 100644
--- a/libcloud/test/dns/test_onapp.py
+++ b/libcloud/test/dns/test_onapp.py
@@ -17,7 +17,7 @@ import unittest
 
 from libcloud.dns.drivers.onapp import OnAppDNSDriver
 from libcloud.dns.types import RecordType
-from libcloud.test import LibcloudTestCase, MockHttpTestCase
+from libcloud.test import LibcloudTestCase, MockHttp
 from libcloud.test.file_fixtures import DNSFileFixtures
 from libcloud.test.secrets import DNS_PARAMS_ONAPP
 from libcloud.utils.py3 import httplib
@@ -166,7 +166,7 @@ class OnAppDNSTests(LibcloudTestCase):
         self.assertTrue(status)
 
 
-class OnAppDNSMockHttp(MockHttpTestCase):
+class OnAppDNSMockHttp(MockHttp):
     fixtures = DNSFileFixtures('onapp')
 
     def _dns_zones_json(self, method, url, body, headers):

http://git-wip-us.apache.org/repos/asf/libcloud/blob/312a08f0/libcloud/test/secrets.py-dist
----------------------------------------------------------------------
diff --git a/libcloud/test/secrets.py-dist b/libcloud/test/secrets.py-dist
index ab0720e..a2e93a4 100644
--- a/libcloud/test/secrets.py-dist
+++ b/libcloud/test/secrets.py-dist
@@ -26,7 +26,7 @@ GCE_PARAMS = ('email@developer.gserviceaccount.com', 'key')  # Service Account
A
 GCE_KEYWORD_PARAMS = {'project': 'project_name'}
 HOSTINGCOM_PARAMS = ('user', 'secret')
 IBM_PARAMS = ('user', 'secret')
-ONAPP_PARAMS = ('key',)
+ONAPP_PARAMS = ('key')
 # OPENSTACK_PARAMS = ('user_name', 'api_key', secure_bool, 'host', port_int)
 OPENSTACK_PARAMS = ('user_name', 'api_key', False, 'host', 8774)
 OPENNEBULA_PARAMS = ('user', 'key')
@@ -90,7 +90,7 @@ DNS_PARAMS_NSONE = ('key', )
 DNS_PARAMS_LUADNS = ('user', 'key')
 DNS_PARAMS_BUDDYNS = ('key', )
 DNS_PARAMS_DNSPOD = ('key', )
-DNS_PARAMS_ONAPP = ('key', 'secret', True, 'host')
+DNS_PARAMS_ONAPP = ('key', 'secret')
 
 # Container
 CONTAINER_PARAMS_DOCKER = ('user', 'password')

http://git-wip-us.apache.org/repos/asf/libcloud/blob/312a08f0/libcloud/test/storage/test_atmos.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_atmos.py b/libcloud/test/storage/test_atmos.py
index 28ba7ba..01f47f5 100644
--- a/libcloud/test/storage/test_atmos.py
+++ b/libcloud/test/storage/test_atmos.py
@@ -33,7 +33,7 @@ from libcloud.storage.types import ContainerAlreadyExistsError, \
 from libcloud.storage.drivers.atmos import AtmosConnection, AtmosDriver
 from libcloud.storage.drivers.dummy import DummyIterator
 
-from libcloud.test import MockHttp
+from libcloud.test import MockHttp, generate_random_data
 from libcloud.test.file_fixtures import StorageFileFixtures
 
 
@@ -750,13 +750,13 @@ class AtmosMockHttp(MockHttp, unittest.TestCase):
 
     def _rest_namespace_foo_bar_container_foo_bar_object(self, method, url,
                                                          body, headers):
-        body = self._generate_random_data(1000)
+        body = generate_random_data(1000)
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
     def _rest_namespace_foo_20_26_20bar_container_foo_20_26_20bar_object(
         self, method, url,
             body, headers):
-        body = self._generate_random_data(1000)
+        body = generate_random_data(1000)
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
     def _rest_namespace_foo_bar_container_foo_bar_object_NOT_FOUND(

http://git-wip-us.apache.org/repos/asf/libcloud/blob/312a08f0/libcloud/test/storage/test_azure_blobs.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_azure_blobs.py b/libcloud/test/storage/test_azure_blobs.py
index 58ccda8..d3a86dc 100644
--- a/libcloud/test/storage/test_azure_blobs.py
+++ b/libcloud/test/storage/test_azure_blobs.py
@@ -39,7 +39,7 @@ from libcloud.storage.drivers.azure_blobs import AzureBlobsStorageDriver
 from libcloud.storage.drivers.azure_blobs import AZURE_BLOCK_MAX_SIZE
 from libcloud.storage.drivers.azure_blobs import AZURE_PAGE_CHUNK_SIZE
 
-from libcloud.test import MockHttp # pylint: disable-msg=E0611
+from libcloud.test import MockHttp, generate_random_data # pylint: disable-msg=E0611
 from libcloud.test.file_fixtures import StorageFileFixtures  # pylint: disable-msg=E0611
 from libcloud.test.secrets import STORAGE_AZURE_BLOBS_PARAMS
 
@@ -342,7 +342,7 @@ class AzureBlobsMockHttp(MockHttp):
 
     def _foo_bar_container_foo_bar_object(self, method, url, body, headers):
         # test_upload_object_invalid_file_size
-        body = self._generate_random_data(1000)
+        body = generate_random_data(1000)
         return (httplib.OK,
                 body,
                 headers,

http://git-wip-us.apache.org/repos/asf/libcloud/blob/312a08f0/libcloud/test/storage/test_cloudfiles.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_cloudfiles.py b/libcloud/test/storage/test_cloudfiles.py
index e42540a..9376dc1 100644
--- a/libcloud/test/storage/test_cloudfiles.py
+++ b/libcloud/test/storage/test_cloudfiles.py
@@ -41,7 +41,7 @@ from libcloud.storage.drivers.cloudfiles import CloudFilesStorageDriver
 
 from libcloud.test import MockHttp  # pylint: disable-msg=E0611
 from libcloud.test import MockHttpTestCase  # pylint: disable-msg=E0611
-from libcloud.test import unittest
+from libcloud.test import unittest, generate_random_data
 from libcloud.test.file_fixtures import StorageFileFixtures  # pylint: disable-msg=E0611
 
 
@@ -1195,7 +1195,7 @@ class CloudFilesMockHttp(MockHttp):
             self, method, url, body, headers):
 
         # test_download_object_success
-        body = self._generate_random_data(1000)
+        body = generate_random_data(1000)
         return (httplib.OK,
                 body,
                 self.base_headers,
@@ -1204,7 +1204,7 @@ class CloudFilesMockHttp(MockHttp):
     def _v1_MossoCloudFS_foo_bar_container_foo_bar_object_INVALID_SIZE(
             self, method, url, body, headers):
         # test_download_object_invalid_file_size
-        body = self._generate_random_data(100)
+        body = generate_random_data(100)
         return (httplib.OK, body,
                 self.base_headers,
                 httplib.responses[httplib.OK])

http://git-wip-us.apache.org/repos/asf/libcloud/blob/312a08f0/libcloud/test/storage/test_oss.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_oss.py b/libcloud/test/storage/test_oss.py
index d2fbe13..912a794 100644
--- a/libcloud/test/storage/test_oss.py
+++ b/libcloud/test/storage/test_oss.py
@@ -47,7 +47,7 @@ from libcloud.storage.drivers.oss import OSSConnection
 from libcloud.storage.drivers.oss import OSSStorageDriver
 from libcloud.storage.drivers.oss import CHUNK_SIZE
 from libcloud.storage.drivers.dummy import DummyIterator
-from libcloud.test import MockHttp  # pylint: disable-msg=E0611
+from libcloud.test import MockHttp, generate_random_data  # pylint: disable-msg=E0611
 from libcloud.test import MockHttpTestCase  # pylint: disable-msg=E0611
 from libcloud.test.file_fixtures import StorageFileFixtures  # pylint: disable-msg=E0611
 from libcloud.test.secrets import STORAGE_OSS_PARAMS
@@ -327,7 +327,7 @@ class OSSMockHttp(MockHttp):
 
     def _foo_bar_object(self, method, url, body, headers):
         # test_download_object_success
-        body = self._generate_random_data(1000)
+        body = generate_random_data(1000)
         return (httplib.OK,
                 body,
                 headers,

http://git-wip-us.apache.org/repos/asf/libcloud/blob/312a08f0/libcloud/test/storage/test_s3.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_s3.py b/libcloud/test/storage/test_s3.py
index 429f5bb..50fcecb 100644
--- a/libcloud/test/storage/test_s3.py
+++ b/libcloud/test/storage/test_s3.py
@@ -50,7 +50,7 @@ from libcloud.utils.py3 import b
 
 from libcloud.test import MockHttp # pylint: disable-msg=E0611
 from libcloud.test import MockHttpTestCase  # pylint: disable-msg=E0611
-from libcloud.test import unittest, make_response
+from libcloud.test import unittest, make_response, generate_random_data
 from libcloud.test.file_fixtures import StorageFileFixtures  # pylint: disable-msg=E0611
 from libcloud.test.secrets import STORAGE_S3_PARAMS
 
@@ -321,7 +321,7 @@ class S3MockHttp(MockHttp):
 
     def _foo_bar_container_foo_bar_object(self, method, url, body, headers):
         # test_download_object_success
-        body = self._generate_random_data(1000)
+        body = generate_random_data(1000)
         return (httplib.OK,
                 body,
                 headers,


Mime
View raw message