[GitHub] libcloud pull request: Use libcloud unittest

2016-01-08 Thread relaxdiego
GitHub user relaxdiego opened a pull request:

https://github.com/apache/libcloud/pull/677

Use libcloud unittest

This changeset includes two patches:

1. Modify Dimension Data tests again to use `libcloud.test.unittest` which 
contains logic for deciding the appropriate package version that works across 
Python versions. This allows us to use assertRaises as a context manager which 
makes the test cleaner.

2. Add an entry in `docs/development.rst` to recommend using 
`libcloud.test.unittest`. This is based on a suggestion from @Kami in PR #674.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/relaxdiego/libcloud use_libcloud_unittest

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/libcloud/pull/677.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #677


commit 3940caf6b2a086b2232e7fa39911c7f6f20eeb93
Author: Mark S. Maglana 
Date:   2016-01-07T17:36:53Z

Multiple improvements to the Dimension Data tests

- Use libcloud.test.unittest instead of the system unittest to ensure
  that newer unittest features are available in older version of Python

- Update all other Dimension Data test cases to use self.assertRaises
  instead of try...except blocks so that, should a regression happen,
  the tests will provide a more helpful message than 'False is not True'

commit 3f020a406d0d65b38dc649d1ecfb4a2e0c443314
Author: Mark S. Maglana 
Date:   2016-01-08T00:50:44Z

Recommend libcloud.test.unittest as the unit testing package




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[1/2] libcloud git commit: Multiple improvements to the Dimension Data tests

2016-01-08 Thread anthonyshaw
Repository: libcloud
Updated Branches:
  refs/heads/trunk 2a2b20080 -> e3bb83801


Multiple improvements to the Dimension Data tests

- Use libcloud.test.unittest instead of the system unittest to ensure
  that newer unittest features are available in older version of Python

- Update all other Dimension Data test cases to use self.assertRaises
  instead of try...except blocks so that, should a regression happen,
  the tests will provide a more helpful message than 'False is not True'


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

Branch: refs/heads/trunk
Commit: 7b5bf4f27436294f3db8534feff393d0a6f51200
Parents: 2a2b200
Author: Mark S. Maglana 
Authored: Thu Jan 7 09:36:53 2016 -0800
Committer: anthony-shaw 
Committed: Sat Jan 9 16:46:27 2016 +1100

--
 libcloud/test/backup/test_dimensiondata.py  | 13 ++---
 libcloud/test/compute/test_dimensiondata.py | 50 +---
 .../test/loadbalancer/test_dimensiondata.py | 13 ++---
 3 files changed, 28 insertions(+), 48 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/7b5bf4f2/libcloud/test/backup/test_dimensiondata.py
--
diff --git a/libcloud/test/backup/test_dimensiondata.py 
b/libcloud/test/backup/test_dimensiondata.py
index 0c81a7f..5121d8b 100644
--- a/libcloud/test/backup/test_dimensiondata.py
+++ b/libcloud/test/backup/test_dimensiondata.py
@@ -14,13 +14,12 @@
 # limitations under the License.
 
 import sys
-import unittest
 from libcloud.utils.py3 import httplib
 
 from libcloud.common.types import InvalidCredsError
 from libcloud.backup.drivers.dimensiondata import DimensionDataBackupDriver as 
DimensionData
 
-from libcloud.test import MockHttp
+from libcloud.test import MockHttp, unittest
 from libcloud.test.backup import TestCaseMixin
 from libcloud.test.file_fixtures import BackupFileFixtures
 
@@ -35,19 +34,13 @@ class DimensionDataTests(unittest.TestCase, TestCaseMixin):
 self.driver = DimensionData(*DIMENSIONDATA_PARAMS)
 
 def test_invalid_region(self):
-try:
+with self.assertRaises(ValueError):
 self.driver = DimensionData(*DIMENSIONDATA_PARAMS, region='blah')
-except ValueError:
-pass
 
 def test_invalid_creds(self):
 DimensionDataMockHttp.type = 'UNAUTHORIZED'
-try:
+with self.assertRaises(InvalidCredsError):
 self.driver.list_targets()
-self.assertTrue(
-False)  # Above command should have thrown an 
InvalidCredsException
-except InvalidCredsError:
-pass
 
 def test_list_targets(self):
 targets = self.driver.list_targets()

http://git-wip-us.apache.org/repos/asf/libcloud/blob/7b5bf4f2/libcloud/test/compute/test_dimensiondata.py
--
diff --git a/libcloud/test/compute/test_dimensiondata.py 
b/libcloud/test/compute/test_dimensiondata.py
index d819334..efe8a25 100644
--- a/libcloud/test/compute/test_dimensiondata.py
+++ b/libcloud/test/compute/test_dimensiondata.py
@@ -19,7 +19,6 @@ except ImportError:
 from xml.etree import ElementTree as ET
 
 import sys
-import unittest
 from libcloud.utils.py3 import httplib
 
 from libcloud.common.types import InvalidCredsError
@@ -28,10 +27,9 @@ from libcloud.common.dimensiondata import 
DimensionDataServerCpuSpecification
 from libcloud.compute.drivers.dimensiondata import DimensionDataNodeDriver as 
DimensionData
 from libcloud.compute.base import Node, NodeAuthPassword, NodeLocation
 
-from libcloud.test import MockHttp
+from libcloud.test import MockHttp, unittest
 from libcloud.test.compute import TestCaseMixin
 from libcloud.test.file_fixtures import ComputeFileFixtures
-
 from libcloud.test.secrets import DIMENSIONDATA_PARAMS
 
 
@@ -43,14 +41,13 @@ class DimensionDataTests(unittest.TestCase, TestCaseMixin):
 self.driver = DimensionData(*DIMENSIONDATA_PARAMS)
 
 def test_invalid_region(self):
-self.assertRaises(ValueError,
-  DimensionData,
-  *DIMENSIONDATA_PARAMS,
-  region='blah')
+with self.assertRaises(ValueError):
+DimensionData(*DIMENSIONDATA_PARAMS, region='blah')
 
 def test_invalid_creds(self):
 DimensionDataMockHttp.type = 'UNAUTHORIZED'
-self.assertRaises(InvalidCredsError, self.driver.list_nodes)
+with self.assertRaises(InvalidCredsError):
+self.driver.list_nodes()
 
 def 

[GitHub] libcloud pull request: Use libcloud unittest

2016-01-08 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/libcloud/pull/677


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] libcloud pull request: Softlayer - Run script in process create no...

2016-01-08 Thread onecloudportal
GitHub user onecloudportal opened a pull request:

https://github.com/apache/libcloud/pull/678

Softlayer - Run script in process create node

Added post_uri parameter to the SoftLayer driver. Run script in process 
create node

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/onecloudportal/libcloud trunk

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/libcloud/pull/678.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #678


commit de75d0aad589285187f97b0f5d0e4a6ce4e65aeb
Author: Marcilene Ribeiro 
Date:   2016-01-08T19:58:14Z

Added post_uri parameter to the SoftLayer driver, for a script to run after 
the machine is provisioned.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


libcloud git commit: auroradns: Properly parse TTL as extra data

2016-01-08 Thread tomaz
Repository: libcloud
Updated Branches:
  refs/heads/trunk a2a36f030 -> a57c80831


auroradns: Properly parse TTL as extra data

Small typo in the list caused this not to be parsed properly

Closes #675

Signed-off-by: Tomaz Muraus 


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

Branch: refs/heads/trunk
Commit: a57c8083104765856c33d5fa603f9458e774c4e3
Parents: a2a36f0
Author: Wido den Hollander 
Authored: Thu Jan 7 16:55:49 2016 +0100
Committer: Tomaz Muraus 
Committed: Fri Jan 8 14:08:06 2016 +0100

--
 libcloud/dns/drivers/auroradns.py   |  2 +-
 libcloud/test/dns/test_auroradns.py | 63 
 libcloud/test/secrets.py-dist   |  1 +
 3 files changed, 65 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/libcloud/blob/a57c8083/libcloud/dns/drivers/auroradns.py
--
diff --git a/libcloud/dns/drivers/auroradns.py 
b/libcloud/dns/drivers/auroradns.py
index e5412e0..e051d0d 100644
--- a/libcloud/dns/drivers/auroradns.py
+++ b/libcloud/dns/drivers/auroradns.py
@@ -38,7 +38,7 @@ API_HOST = 'api.auroradns.eu'
 DEFAULT_ZONE_TTL = 3600
 DEFAULT_ZONE_TYPE = 'master'
 
-VALID_RECORD_PARAMS_EXTRA = ['ttl' 'prio', 'health_check_id', 'disabled']
+VALID_RECORD_PARAMS_EXTRA = ['ttl', 'prio', 'health_check_id', 'disabled']
 
 
 class AuroraDNSResponse(JsonResponse):

http://git-wip-us.apache.org/repos/asf/libcloud/blob/a57c8083/libcloud/test/dns/test_auroradns.py
--
diff --git a/libcloud/test/dns/test_auroradns.py 
b/libcloud/test/dns/test_auroradns.py
new file mode 100644
index 000..afd9b10
--- /dev/null
+++ b/libcloud/test/dns/test_auroradns.py
@@ -0,0 +1,63 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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
+
+import sys
+import unittest
+
+from libcloud.dns.drivers.auroradns import AuroraDNSDriver
+from libcloud.dns.types import RecordType
+from libcloud.test import LibcloudTestCase, MockHttpTestCase
+from libcloud.test.secrets import DNS_PARAMS_AURORADNS
+from libcloud.test.file_fixtures import DNSFileFixtures
+
+
+class AuroraDNSDriverTests(LibcloudTestCase):
+
+def setUp(self):
+AuroraDNSDriver.connectionCls.conn_classes = \
+(None, AuroraDNSDriverMockHttp)
+AuroraDNSDriverMockHttp.type = None
+self.driver = AuroraDNSDriver(*DNS_PARAMS_AURORADNS)
+
+def test_merge_extra_data(self):
+rdata = {
+'name': 'localhost',
+'type': RecordType.A,
+'content': '127.0.0.1'
+}
+
+params = {'ttl': 900,
+  'prio': 0,
+  'health_check_id': None,
+  'disabled': False}
+
+for param in params:
+extra = {
+param: params[param]
+}
+
+data = self.driver._AuroraDNSDriver__merge_extra_data(rdata,
+  extra)
+self.assertEqual(data['content'], '127.0.0.1')
+self.assertEqual(data['type'], RecordType.A)
+self.assertEqual(data[param], params[param])
+self.assertEqual(data['name'], 'localhost')
+
+
+class AuroraDNSDriverMockHttp(MockHttpTestCase):
+fixtures = DNSFileFixtures('auroradns')
+
+
+if __name__ == '__main__':
+sys.exit(unittest.main())

http://git-wip-us.apache.org/repos/asf/libcloud/blob/a57c8083/libcloud/test/secrets.py-dist
--
diff --git a/libcloud/test/secrets.py-dist b/libcloud/test/secrets.py-dist
index cb0ab4a..dfc7a5b 100644
--- a/libcloud/test/secrets.py-dist
+++ b/libcloud/test/secrets.py-dist
@@ -80,3 +80,4 @@ DNS_PARAMS_ZONOMI = ('key')
 DNS_PARAMS_DURABLEDNS = ('api_user', 'api_key')
 DNS_PARAMS_GODADDY = ('customer-id', 'api_user',