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 2016/04/13 14:19:14 UTC
[2/4] libcloud git commit: Added account details to base class for
Dimension Data and tests
Added account details to base class for Dimension Data and tests
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/477f2227
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/477f2227
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/477f2227
Branch: refs/heads/trunk
Commit: 477f2227c1fc31ec8b4fbf623d7de415a62adc6e
Parents: 965d4fe
Author: anthony-shaw <an...@apache.org>
Authored: Wed Apr 13 22:14:46 2016 +1000
Committer: anthony-shaw <an...@apache.org>
Committed: Wed Apr 13 22:14:46 2016 +1000
----------------------------------------------------------------------
libcloud/common/dimensiondata.py | 26 ++++++++++++++
libcloud/dns/types.py.rej | 46 ++++++++++++++++++++++++
libcloud/test/compute/test_dimensiondata.py | 7 ++++
3 files changed, 79 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/477f2227/libcloud/common/dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/common/dimensiondata.py b/libcloud/common/dimensiondata.py
index b7ee2d0..70cdb8b 100644
--- a/libcloud/common/dimensiondata.py
+++ b/libcloud/common/dimensiondata.py
@@ -555,6 +555,32 @@ class DimensionDataConnection(ConnectionUserAndKey):
self._orgId = findtext(body, 'orgId', DIRECTORY_NS)
return self._orgId
+ def get_account_details(self):
+ """
+ Get the details of this account
+
+ :rtype: :class:`DimensionDataAccountDetails`
+ """
+ body = self.request_api_1('myaccount').object
+ return DimensionDataAccountDetails(
+ user_name=findtext(body, 'userName', DIRECTORY_NS),
+ full_name=findtext(body, 'fullName', DIRECTORY_NS),
+ first_name=findtext(body, 'firstName', DIRECTORY_NS),
+ last_name=findtext(body, 'lastName', DIRECTORY_NS),
+ email=findtext(body, 'emailAddress', DIRECTORY_NS))
+
+
+class DimensionDataAccountDetails(object):
+ """
+ Dimension Data account class details
+ """
+ def __init__(self, user_name, full_name, first_name, last_name, email):
+ self.user_name = user_name
+ self.full_name = full_name
+ self.first_name = first_name
+ self.last_name = last_name
+ self.email = email
+
class DimensionDataStatus(object):
"""
http://git-wip-us.apache.org/repos/asf/libcloud/blob/477f2227/libcloud/dns/types.py.rej
----------------------------------------------------------------------
diff --git a/libcloud/dns/types.py.rej b/libcloud/dns/types.py.rej
new file mode 100644
index 0000000..246c69d
--- /dev/null
+++ b/libcloud/dns/types.py.rej
@@ -0,0 +1,46 @@
+diff a/libcloud/dns/types.py b/libcloud/dns/types.py (rejected hunks)
+@@ -31,28 +31,28 @@
+
+ class Provider(object):
+ DUMMY = 'dummy'
+- LINODE = 'linode'
+- RACKSPACE = 'rackspace'
+- ZERIGO = 'zerigo'
+- ROUTE53 = 'route53'
+- HOSTVIRTUAL = 'hostvirtual'
+- GANDI = 'gandi'
+- GOOGLE = 'google'
+- SOFTLAYER = 'softlayer'
+- DIGITAL_OCEAN = 'digitalocean'
+ AURORADNS = 'auroradns'
+- WORLDWIDEDNS = 'worldwidedns'
++ CLOUDFLARE = 'cloudflare'
++ DIGITAL_OCEAN = 'digitalocean'
+ DNSIMPLE = 'dnsimple'
+- POINTDNS = 'pointdns'
+- VULTR = 'vultr'
+- LIQUIDWEB = 'liquidweb'
+- ZONOMI = 'zonomi'
+ DURABLEDNS = 'durabledns'
++ GANDI = 'gandi'
+ GODADDY = 'godaddy'
+- CLOUDFLARE = 'cloudflare'
+- NSONE = 'nsone'
++ GOOGLE = 'google'
++ HOSTVIRTUAL = 'hostvirtual'
++ LINODE = 'linode'
++ LIQUIDWEB = 'liquidweb'
+ LUADNS = 'luadns'
+ NFSN = 'nfsn'
++ NSONE = 'nsone'
++ POINTDNS = 'pointdns'
++ RACKSPACE = 'rackspace'
++ ROUTE53 = 'route53'
++ SOFTLAYER = 'softlayer'
++ VULTR = 'vultr'
++ WORLDWIDEDNS = 'worldwidedns'
++ ZERIGO = 'zerigo'
++ ZONOMI = 'zonomi'
+ # Deprecated
+ RACKSPACE_US = 'rackspace_us'
+ RACKSPACE_UK = 'rackspace_uk'
http://git-wip-us.apache.org/repos/asf/libcloud/blob/477f2227/libcloud/test/compute/test_dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_dimensiondata.py b/libcloud/test/compute/test_dimensiondata.py
index 7554410..d96142d 100644
--- a/libcloud/test/compute/test_dimensiondata.py
+++ b/libcloud/test/compute/test_dimensiondata.py
@@ -51,6 +51,13 @@ class DimensionDataTests(unittest.TestCase, TestCaseMixin):
with self.assertRaises(InvalidCredsError):
self.driver.list_nodes()
+ def test_get_account_details(self):
+ DimensionDataMockHttp.type = None
+ ret = self.driver.connection.get_account_details()
+ self.assertEqual(ret.full_name, 'Test User')
+ self.assertEqual(ret.first_name, 'Test')
+ self.assertEqual(ret.email, 'test@example.com')
+
def test_list_locations_response(self):
DimensionDataMockHttp.type = None
ret = self.driver.list_locations()