You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2017/04/02 11:38:53 UTC
[11/16] libcloud git commit: merge from trunk, pylint and lint updates
merge from trunk, pylint and lint updates
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/a5ff955d
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/a5ff955d
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/a5ff955d
Branch: refs/heads/trunk
Commit: a5ff955d2b8b701e179426d2c496a368a10a1e69
Parents: a9f9cb0
Author: Anthony Shaw <an...@apache.org>
Authored: Fri Jan 13 12:09:54 2017 +1100
Committer: Anthony Shaw <an...@apache.org>
Committed: Fri Jan 13 12:09:54 2017 +1100
----------------------------------------------------------------------
integration/__main__.py | 9 +++++----
integration/api/__main__.py | 4 +---
integration/api/data.py | 2 +-
integration/api/routes.py | 10 ++++++----
integration/api/util.py | 8 +++-----
integration/config.py | 2 +-
integration/driver/test.py | 6 +++---
7 files changed, 20 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/a5ff955d/integration/__main__.py
----------------------------------------------------------------------
diff --git a/integration/__main__.py b/integration/__main__.py
index 9e70f7d..9977798 100644
--- a/integration/__main__.py
+++ b/integration/__main__.py
@@ -1,12 +1,13 @@
import unittest
import sys
-from .driver.test import TestNodeDriver
+from integration.driver.test import TestNodeDriver
+
+from integration.api.data import NODES, REPORT_DATA
-from .api.data import NODES, REPORT_DATA
class IntegrationTest(unittest.TestCase):
- def setUp(self):
+ def setUp(self):
self.instance = TestNodeDriver('apache', 'libcloud', secure=False,
host='localhost', port=9898)
@@ -30,7 +31,7 @@ class IntegrationTest(unittest.TestCase):
"""
Test that a raw request can correctly return the data
"""
- data = self.instance.ex_report_data().body
+ data = self.instance.ex_report_data()
self.assertEqual(data, REPORT_DATA)
if __name__ == '__main__':
http://git-wip-us.apache.org/repos/asf/libcloud/blob/a5ff955d/integration/api/__main__.py
----------------------------------------------------------------------
diff --git a/integration/api/__main__.py b/integration/api/__main__.py
index 94c6e37..85d7dc7 100644
--- a/integration/api/__main__.py
+++ b/integration/api/__main__.py
@@ -13,11 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from functools import wraps
-
from bottle import run
-from .routes import *
+import integration.api.routes # noqa
if __name__ == '__main__':
run(host='localhost', port=9898)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/a5ff955d/integration/api/data.py
----------------------------------------------------------------------
diff --git a/integration/api/data.py b/integration/api/data.py
index ece9fa4..d292ad9 100644
--- a/integration/api/data.py
+++ b/integration/api/data.py
@@ -34,4 +34,4 @@ NODES = [
'extra': {'test-key': 'test-value'}}
]
-REPORT_DATA = "Around the ragged rocks, the ragged rascal ran. \r\n"
\ No newline at end of file
+REPORT_DATA = "Around the ragged rocks, the ragged rascal ran. \r\n"
http://git-wip-us.apache.org/repos/asf/libcloud/blob/a5ff955d/integration/api/routes.py
----------------------------------------------------------------------
diff --git a/integration/api/routes.py b/integration/api/routes.py
index b333aec..05fd0ec 100644
--- a/integration/api/routes.py
+++ b/integration/api/routes.py
@@ -15,17 +15,19 @@
import json
-from bottle import route, template
+from bottle import route
+
+from integration.api.data import NODES, REPORT_DATA
+from integration.api.util import secure
-from .data import NODES, REPORT_DATA
-from .util import secure
@route('/compute/nodes', method='GET')
@secure
def list_nodes():
return json.dumps(NODES)
+
@route('/compute/report_data', method='GET')
@secure
def ex_report_data():
- return REPORT_DATA
\ No newline at end of file
+ return REPORT_DATA
http://git-wip-us.apache.org/repos/asf/libcloud/blob/a5ff955d/integration/api/util.py
----------------------------------------------------------------------
diff --git a/integration/api/util.py b/integration/api/util.py
index c4478e5..5b5e1f1 100644
--- a/integration/api/util.py
+++ b/integration/api/util.py
@@ -13,13 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from bottle import run, request
-import base64
+from bottle import request
from functools import wraps
-from libcloud.utils.py3 import b
+from integration.config import EXPECTED_AUTH
-from ..config import EXPECTED_AUTH
def secure(f):
@wraps(f)
@@ -32,4 +30,4 @@ def secure(f):
if auth != EXPECTED_AUTH:
raise Exception('Bad authentication')
return f(*args, **kwargs)
- return secure_route
\ No newline at end of file
+ return secure_route
http://git-wip-us.apache.org/repos/asf/libcloud/blob/a5ff955d/integration/config.py
----------------------------------------------------------------------
diff --git a/integration/config.py b/integration/config.py
index d5e524d..d7347fd 100644
--- a/integration/config.py
+++ b/integration/config.py
@@ -18,4 +18,4 @@ from libcloud.utils.py3 import b
API_AUTH = ('apache', 'libcloud')
-EXPECTED_AUTH = 'Basic %s' % (base64.b64encode(b('%s:%s' % API_AUTH)))
\ No newline at end of file
+EXPECTED_AUTH = 'Basic %s' % (base64.b64encode(b('%s:%s' % API_AUTH)))
http://git-wip-us.apache.org/repos/asf/libcloud/blob/a5ff955d/integration/driver/test.py
----------------------------------------------------------------------
diff --git a/integration/driver/test.py b/integration/driver/test.py
index a3ac1dc..b8bd296 100644
--- a/integration/driver/test.py
+++ b/integration/driver/test.py
@@ -56,14 +56,14 @@ class TestNodeDriver(NodeDriver):
name = 'Test Compute Driver'
website = 'http://libcloud.apache.org'
features = {'create_node': ['ssh_key', 'password']}
-
+
def __init__(self, key, secret=None, secure=True,
host=None, port=None, **kwargs):
super(TestNodeDriver, self).__init__(key=key, secret=secret,
secure=secure, host=host,
port=port,
**kwargs)
-
+
def list_nodes(self):
r = self.connection.request('/compute/nodes')
nodes = []
@@ -73,4 +73,4 @@ class TestNodeDriver(NodeDriver):
def ex_report_data(self):
r = self.connection.request('/compute/report_data', raw=True)
- return r.response.read()
\ No newline at end of file
+ return r.response.read()