Add auto_renew attribute to subscription class.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/70038471 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/70038471 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/70038471 Branch: refs/heads/trunk Commit: 700384716e584385ffe78d62e5d97fc6fc263863 Parents: 0d7b5a5 Author: Tomaz Muraus <[email protected]> Authored: Fri Jan 31 18:13:38 2014 +0100 Committer: Tomaz Muraus <[email protected]> Committed: Fri Jan 31 18:13:38 2014 +0100 ---------------------------------------------------------------------- libcloud/compute/drivers/cloudsigma.py | 9 +++++++-- libcloud/test/compute/test_cloudsigma_v2_0.py | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/70038471/libcloud/compute/drivers/cloudsigma.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/cloudsigma.py b/libcloud/compute/drivers/cloudsigma.py index 5000a33..990f906 100644 --- a/libcloud/compute/drivers/cloudsigma.py +++ b/libcloud/compute/drivers/cloudsigma.py @@ -689,7 +689,7 @@ class CloudSigmaSubscription(object): """ def __init__(self, id, resource, amount, period, status, price, start_time, - end_time): + end_time, auto_renew): """ :param id: Subscription ID. :type id: ``str`` @@ -711,6 +711,9 @@ class CloudSigmaSubscription(object): :param end_time: End time for this subscription. :type end_time: ``datetime.datetime`` + + :param auto_renew: True if the subscription is auto renewed. + :type auto_renew: ``bool`` """ self.id = id self.resource = resource @@ -720,6 +723,7 @@ class CloudSigmaSubscription(object): self.price = price self.start_time = start_time self.end_time = end_time + self.auto_renew = auto_renew def __str__(self): return self.__repr__() @@ -1908,7 +1912,8 @@ class CloudSigma_2_0_NodeDriver(CloudSigmaNodeDriver): status=data['status'], price=data['price'], start_time=start_time, - end_time=end_time) + end_time=end_time, + auto_renew=data['auto_renew']) return subscription def _to_firewall_policy(self, data): http://git-wip-us.apache.org/repos/asf/libcloud/blob/70038471/libcloud/test/compute/test_cloudsigma_v2_0.py ---------------------------------------------------------------------- diff --git a/libcloud/test/compute/test_cloudsigma_v2_0.py b/libcloud/test/compute/test_cloudsigma_v2_0.py index 7d04682..aa5035e 100644 --- a/libcloud/test/compute/test_cloudsigma_v2_0.py +++ b/libcloud/test/compute/test_cloudsigma_v2_0.py @@ -346,6 +346,7 @@ class CloudSigmaAPI20BaseTestCase(object): self.assertEqual(subscription.period, '1 month') self.assertEqual(subscription.resource, 'vlan') self.assertEqual(subscription.price, '10.26666666666666666666666667') + self.assertEqual(subscription.auto_renew, False) def test_ex_list_subscriptions_status_filterting(self): CloudSigmaMockHttp.type = 'STATUS_FILTER'
