libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [3/5] libcloud git commit: DimensionData: Adding in new methods/tests for backups
Date Wed, 10 Feb 2016 01:08:39 GMT
DimensionData: Adding in new methods/tests for backups


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

Branch: refs/heads/trunk
Commit: fe86be74e06a0da6af9400173270e48554567cc4
Parents: 513bc17
Author: Jeffrey Dunham <jeffrey.a.dunham@gmail.com>
Authored: Mon Feb 8 13:48:12 2016 -0500
Committer: anthony-shaw <anthony.p.shaw@gmail.com>
Committed: Wed Feb 10 12:08:06 2016 +1100

----------------------------------------------------------------------
 libcloud/backup/drivers/dimensiondata.py        | 138 +++++++++++++++++++
 ...ead52_692f_4314_8725_c8a4f4d13a87_backup.xml |  18 ---
 ...2f_4314_8725_c8a4f4d13a87_backup_DISABLE.xml |   7 +
 ...92f_4314_8725_c8a4f4d13a87_backup_ENABLE.xml |  18 +++
 ..._692f_4314_8725_c8a4f4d13a87_backup_INFO.xml |  11 ++
 ...5_c8a4f4d13a87_backup_client_SUCCESS_PUT.xml |  13 ++
 libcloud/test/backup/test_dimensiondata.py      |  42 +++++-
 7 files changed, 226 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/fe86be74/libcloud/backup/drivers/dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/backup/drivers/dimensiondata.py b/libcloud/backup/drivers/dimensiondata.py
index 15e8251..e35fd76 100644
--- a/libcloud/backup/drivers/dimensiondata.py
+++ b/libcloud/backup/drivers/dimensiondata.py
@@ -38,6 +38,41 @@ class DimensionDataBackupClientType(object):
         self.description = description
 
 
+class DimensionDataBackupDetails(object):
+    def __init__(self, asset_id, service_plan, state, clients=[]):
+        self.asset_id = asset_id
+        self.service_plan = service_plan
+        self.state = state
+        self.clients = clients
+
+
+class DimensionDataBackupClient(object):
+    def __init__(self, type, is_file_system, status, description,
+                 schedule_pol, storage_pol, trigger=None, email=None,
+                 last_backup_time=None, next_backup=None, download_url=None,
+                 total_backup_size=None, running_job=None):
+        self.type = type
+        self.is_file_system = is_file_system
+        self.status = status
+        self.description = description
+        self.schedule_policy = schedule_pol
+        self.storage_policy = storage_pol
+        self.trigger = trigger
+        self.email = email
+        self.last_backup_time = last_backup_time
+        self.next_backup = next_backup
+        self.total_backup_size = total_backup_size
+        self.download_url = download_url
+        self.running_job = running_job
+
+
+class DimensionDataBackupRunningJob(object):
+    def __init__(self, id, status, percentage=0):
+        self.id = id
+        self.percentage = percentage
+        self.status = status
+
+
 class DimensionDataBackupStoragePolicy(object):
     def __init__(self, name, retention_period, secondary_location):
         self.name = name
@@ -232,6 +267,8 @@ class DimensionDataBackupDriver(BackupDriver):
 
         :param target: Backup target to delete
         :type  target: Instance of :class:`BackupTarget`
+
+        :rtype: ``bool``
         """
         response = self.connection.request_with_orgId_api_1(
             'server/%s/backup?disable' % (target.address),
@@ -384,6 +421,73 @@ class DimensionDataBackupDriver(BackupDriver):
         raise NotImplementedError(
             'cancel_target_job not implemented for this driver')
 
+    def ex_add_client_to_target(self, target, client, storage_policy,
+                                schedule_policy, trigger, email):
+        """
+        Add a client to a target
+
+        :param target: Backup target with the backup data
+        :type  target: Instance of :class:`BackupTarget` or ``str``
+
+        :param client: Client to add to the target
+        :type  client: ``str``
+
+        :param storage_policy: The storage policy for the client
+        :type  storage_policy: ``str``
+
+        :param schedule_policy: The storage policy for the client
+        :type  schedule_policy: ``str``
+
+        :param trigger: The notify trigger for the client
+        :type  trigger: ``str``
+
+        :param email: The notify email for the client
+        :type  email: ``str``
+
+        :rtype: ``bool``
+        """
+
+        if isinstance(target, BackupTarget):
+            server_id = target.address
+        else:
+            server_id = target
+
+        backup_elm = ET.Element('NewBackupClient',
+                                {'xmlns': BACKUP_NS})
+        ET.SubElement(backup_elm, "type").text = client
+        ET.SubElement(backup_elm, "storagePolicyName").text = storage_policy
+        ET.SubElement(backup_elm, "schedulePolicyName").text = schedule_policy
+        alerting_elm = ET.SubElement(backup_elm, "alerting")
+        ET.SubElement(alerting_elm, "trigger").text = trigger
+        ET.SubElement(alerting_elm, "emailAddress").text = email
+
+        response = self.connection.request_with_orgId_api_1(
+            'server/%s/backup/client' % (server_id),
+            method='POST',
+            data=ET.tostring(backup_elm)).object
+
+        response_code = findtext(response, 'result', GENERAL_NS)
+        return response_code in ['IN_PROGRESS', 'SUCCESS']
+
+    def ex_get_backup_details_for_target(self, target):
+        """
+        Returns a list of available backup client types
+
+        :param  target: The backup target to list available types for
+        :type   target: :class:`BackupTarget` or ``str``
+
+        :rtype: ``list`` of :class:`DimensionDataBackupDetails`
+        """
+
+        if isinstance(target, BackupTarget):
+            server_id = target.address
+        else:
+            server_id = target
+        response = self.connection.request_with_orgId_api_1(
+            'server/%s/backup' % (server_id),
+            method='GET').object
+        return self._to_backup_details(response)
+
     def ex_list_available_client_types(self, target):
         """
         Returns a list of available backup client types
@@ -461,6 +565,40 @@ class DimensionDataBackupDriver(BackupDriver):
             is_file_system=bool(element.get('isFileSystem') == 'true')
         )
 
+    def _to_backup_details(self, object):
+        return DimensionDataBackupDetails(
+            asset_id=object.get('asset_id'),
+            service_plan=object.get('servicePlan'),
+            state=object.get('state'),
+            clients=self._to_clients(object)
+        )
+
+    def _to_clients(self, object):
+        elements = object.findall(fixxpath('backupClient', BACKUP_NS))
+
+        return [self._to_client(el) for el in elements]
+
+    def _to_client(self, element):
+        job = element.find(fixxpath('runningJob', BACKUP_NS))
+        running_job = None
+        if job is not None:
+            running_job = DimensionDataBackupRunningJob(
+                id=job.get('id'),
+                status=job.get('status'),
+                percentage=int(job.get('percentageComplete'))
+            )
+
+        return DimensionDataBackupClient(
+            type=element.get('type'),
+            is_file_system=bool(element.get('isFileSystem') == 'true'),
+            status=element.get('status'),
+            description=findtext(element, 'description', BACKUP_NS),
+            schedule_pol=findtext(element, 'schedulePolicyName', BACKUP_NS),
+            storage_pol=findtext(element, 'storagePolicyName', BACKUP_NS),
+            download_url=findtext(element, 'downloadUrl', BACKUP_NS),
+            running_job=running_job
+        )
+
     def _to_targets(self, object):
         node_elements = object.findall(fixxpath('server', TYPES_URN))
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/fe86be74/libcloud/test/backup/fixtures/dimensiondata/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/backup/fixtures/dimensiondata/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup.xml
b/libcloud/test/backup/fixtures/dimensiondata/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup.xml
deleted file mode 100644
index 6012447..0000000
--- a/libcloud/test/backup/fixtures/dimensiondata/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<ns6:Status xmlns:ns16="http://oec.api.opsource.net/schemas/storage"
-            xmlns="http://oec.api.opsource.net/schemas/server"
-            xmlns:ns14="http://oec.api.opsource.net/schemas/support"
-            xmlns:ns15="http://oec.api.opsource.net/schemas/multigeo"
-            xmlns:ns9="http://oec.api.opsource.net/schemas/admin"
-            xmlns:ns5="http://oec.api.opsource.net/schemas/vip"
-            xmlns:ns12="http://oec.api.opsource.net/schemas/whitelabel"
-            xmlns:ns13="http://oec.api.opsource.net/schemas/reset"
-            xmlns:ns6="http://oec.api.opsource.net/schemas/general" xmlns:ns7="http://oec.api.opsource.net/schemas/datacenter"
xmlns:ns10="http://oec.api.opsource.net/schemas/serverbootstrap" xmlns:ns8="http://oec.api.opsource.net/schemas/manualimport"
xmlns:ns11="http://oec.api.opsource.net/schemas/backup" xmlns:ns2="http://oec.api.opsource.net/schemas/directory"
xmlns:ns4="http://oec.api.opsource.net/schemas/network" xmlns:ns3="http://oec.api.opsource.net/schemas/organization">
-    <ns6:operation>Enable Backup for Server</ns6:operation>
-    <ns6:result>SUCCESS</ns6:result>
-    <ns6:resultDetail>Backup enabled for Server - see additional Information for Asset
ID</ns6:resultDetail>
-    <ns6:resultCode>REASON_0</ns6:resultCode>
-    <ns6:additionalInformation name="assetId">
-        <ns6:value>ee7c4b64-f7af-4a4f-8384-be362273530f</ns6:value>
-    </ns6:additionalInformation>
-</ns6:Status>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/fe86be74/libcloud/test/backup/fixtures/dimensiondata/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_DISABLE.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/backup/fixtures/dimensiondata/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_DISABLE.xml
b/libcloud/test/backup/fixtures/dimensiondata/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_DISABLE.xml
new file mode 100644
index 0000000..bfc949d
--- /dev/null
+++ b/libcloud/test/backup/fixtures/dimensiondata/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_DISABLE.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<ns13:Status xmlns:ns16="http://oec.api.opsource.net/schemas/serverbootstrap" xmlns="http://oec.api.opsource.net/schemas/server"
xmlns:ns14="http://oec.api.opsource.net/schemas/datacenter" xmlns:ns15="http://oec.api.opsource.net/schemas/reset"
xmlns:ns9="http://oec.api.opsource.net/schemas/storage" xmlns:ns5="http://oec.api.opsource.net/schemas/backup"
xmlns:ns12="http://oec.api.opsource.net/schemas/whitelabel" xmlns:ns13="http://oec.api.opsource.net/schemas/general"
xmlns:ns6="http://oec.api.opsource.net/schemas/support" xmlns:ns7="http://oec.api.opsource.net/schemas/organization"
xmlns:ns10="http://oec.api.opsource.net/schemas/manualimport" xmlns:ns8="http://oec.api.opsource.net/schemas/multigeo"
xmlns:ns11="http://oec.api.opsource.net/schemas/vip" xmlns:ns2="http://oec.api.opsource.net/schemas/network"
xmlns:ns4="http://oec.api.opsource.net/schemas/directory" xmlns:ns3="http://oec.api.opsource.net/schemas/admin">
+    <ns13:operation>Disable Backup for Server</ns13:operation>
+    <ns13:result>SUCCESS</ns13:result>
+    <ns13:resultDetail>Backup disabled for Server</ns13:resultDetail>
+    <ns13:resultCode>REASON_0</ns13:resultCode>
+</ns13:Status>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/fe86be74/libcloud/test/backup/fixtures/dimensiondata/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_ENABLE.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/backup/fixtures/dimensiondata/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_ENABLE.xml
b/libcloud/test/backup/fixtures/dimensiondata/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_ENABLE.xml
new file mode 100644
index 0000000..6012447
--- /dev/null
+++ b/libcloud/test/backup/fixtures/dimensiondata/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_ENABLE.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<ns6:Status xmlns:ns16="http://oec.api.opsource.net/schemas/storage"
+            xmlns="http://oec.api.opsource.net/schemas/server"
+            xmlns:ns14="http://oec.api.opsource.net/schemas/support"
+            xmlns:ns15="http://oec.api.opsource.net/schemas/multigeo"
+            xmlns:ns9="http://oec.api.opsource.net/schemas/admin"
+            xmlns:ns5="http://oec.api.opsource.net/schemas/vip"
+            xmlns:ns12="http://oec.api.opsource.net/schemas/whitelabel"
+            xmlns:ns13="http://oec.api.opsource.net/schemas/reset"
+            xmlns:ns6="http://oec.api.opsource.net/schemas/general" xmlns:ns7="http://oec.api.opsource.net/schemas/datacenter"
xmlns:ns10="http://oec.api.opsource.net/schemas/serverbootstrap" xmlns:ns8="http://oec.api.opsource.net/schemas/manualimport"
xmlns:ns11="http://oec.api.opsource.net/schemas/backup" xmlns:ns2="http://oec.api.opsource.net/schemas/directory"
xmlns:ns4="http://oec.api.opsource.net/schemas/network" xmlns:ns3="http://oec.api.opsource.net/schemas/organization">
+    <ns6:operation>Enable Backup for Server</ns6:operation>
+    <ns6:result>SUCCESS</ns6:result>
+    <ns6:resultDetail>Backup enabled for Server - see additional Information for Asset
ID</ns6:resultDetail>
+    <ns6:resultCode>REASON_0</ns6:resultCode>
+    <ns6:additionalInformation name="assetId">
+        <ns6:value>ee7c4b64-f7af-4a4f-8384-be362273530f</ns6:value>
+    </ns6:additionalInformation>
+</ns6:Status>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/fe86be74/libcloud/test/backup/fixtures/dimensiondata/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_INFO.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/backup/fixtures/dimensiondata/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_INFO.xml
b/libcloud/test/backup/fixtures/dimensiondata/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_INFO.xml
new file mode 100644
index 0000000..8b5cf55
--- /dev/null
+++ b/libcloud/test/backup/fixtures/dimensiondata/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_INFO.xml
@@ -0,0 +1,11 @@
+<ns5:BackupDetails assetId="fbf90c74-a6de-459e-942c-b75b5176ed72" servicePlan="Enterprise"
state="NORMAL" xmlns:ns16="http://oec.api.opsource.net/schemas/serverbootstrap" xmlns="http://oec.api.opsource.net/schemas/server"
xmlns:ns14="http://oec.api.opsource.net/schemas/datacenter" xmlns:ns15="http://oec.api.opsource.net/schemas/reset"
xmlns:ns9="http://oec.api.opsource.net/schemas/storage" xmlns:ns5="http://oec.api.opsource.net/schemas/backup"
xmlns:ns12="http://oec.api.opsource.net/schemas/whitelabel" xmlns:ns13="http://oec.api.opsource.net/schemas/general"
xmlns:ns6="http://oec.api.opsource.net/schemas/support" xmlns:ns7="http://oec.api.opsource.net/schemas/organization"
xmlns:ns10="http://oec.api.opsource.net/schemas/manualimport" xmlns:ns8="http://oec.api.opsource.net/schemas/multigeo"
xmlns:ns11="http://oec.api.opsource.net/schemas/vip" xmlns:ns2="http://oec.api.opsource.net/schemas/network"
xmlns:ns4="http://oec.api.opsource.net/schemas/directory" xmlns:ns3="http://oec.api.ops
 ource.net/schemas/admin">
+    <ns5:backupClient id="5fe7502e-f8d7-4547-93b5-f54ac6e58281" type="FA.Linux" isFileSystem="true"
status="Offline">
+        <ns5:description>Linux File Agent</ns5:description>
+        <ns5:schedulePolicyName>12AM - 6AM</ns5:schedulePolicyName>
+        <ns5:storagePolicyName>30 Day Storage Policy + Secondary Copy</ns5:storagePolicyName>
+        <ns5:times nextBackup="2016-02-09T00:00:00" lastOnline="2016-02-08T06:10:25"/>
+        <ns5:totalBackupSizeGb>0</ns5:totalBackupSizeGb>
+        <ns5:downloadUrl>https://backups-na.cloud-vpn.net/PCS/BackupClientInstallerDownload/27645708a713cf406b47ccf73895cc8d27d4172c</ns5:downloadUrl>
+        <ns5:runningJob id="106130" name="Backup" percentageComplete="5" status="Waiting"/>
+    </ns5:backupClient>
+</ns5:BackupDetails>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/fe86be74/libcloud/test/backup/fixtures/dimensiondata/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_client_SUCCESS_PUT.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/backup/fixtures/dimensiondata/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_client_SUCCESS_PUT.xml
b/libcloud/test/backup/fixtures/dimensiondata/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_client_SUCCESS_PUT.xml
new file mode 100644
index 0000000..87b4130
--- /dev/null
+++ b/libcloud/test/backup/fixtures/dimensiondata/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_client_SUCCESS_PUT.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<ns13:Status xmlns:ns16="http://oec.api.opsource.net/schemas/serverbootstrap" xmlns="http://oec.api.opsource.net/schemas/server"
xmlns:ns14="http://oec.api.opsource.net/schemas/datacenter" xmlns:ns15="http://oec.api.opsource.net/schemas/reset"
xmlns:ns9="http://oec.api.opsource.net/schemas/storage" xmlns:ns5="http://oec.api.opsource.net/schemas/backup"
xmlns:ns12="http://oec.api.opsource.net/schemas/whitelabel" xmlns:ns13="http://oec.api.opsource.net/schemas/general"
xmlns:ns6="http://oec.api.opsource.net/schemas/support" xmlns:ns7="http://oec.api.opsource.net/schemas/organization"
xmlns:ns10="http://oec.api.opsource.net/schemas/manualimport" xmlns:ns8="http://oec.api.opsource.net/schemas/multigeo"
xmlns:ns11="http://oec.api.opsource.net/schemas/vip" xmlns:ns2="http://oec.api.opsource.net/schemas/network"
xmlns:ns4="http://oec.api.opsource.net/schemas/directory" xmlns:ns3="http://oec.api.opsource.net/schemas/admin">
+    <ns13:operation>Add Backup Client</ns13:operation>
+    <ns13:result>SUCCESS</ns13:result>
+    <ns13:resultDetail>Backup Client added</ns13:resultDetail>
+    <ns13:resultCode>REASON_0</ns13:resultCode>
+    <ns13:additionalInformation name="backupClient.id">
+        <ns13:value>a26cead0-6bab-4446-9a16-c227e6ab201f</ns13:value>
+    </ns13:additionalInformation>
+    <ns13:additionalInformation name="backupClient.downloadUrl">
+        <ns13:value>https://backups-na.cloud-vpn.net/PCS/BackupClientInstallerDownload/4b3f35815b848ce7270186b52e5817fa5de0fe42</ns13:value>
+    </ns13:additionalInformation>
+</ns13:Status>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/fe86be74/libcloud/test/backup/test_dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/test/backup/test_dimensiondata.py b/libcloud/test/backup/test_dimensiondata.py
index 11d2b73..ef03179 100644
--- a/libcloud/test/backup/test_dimensiondata.py
+++ b/libcloud/test/backup/test_dimensiondata.py
@@ -79,6 +79,21 @@ class DimensionDataTests(unittest.TestCase, TestCaseMixin):
         target = self.driver.list_targets()[0]
         self.assertTrue(self.driver.delete_target(target))
 
+    def test_ex_add_client_to_target(self):
+        target = self.driver.list_targets()[0]
+        self.assertTrue(
+            self.driver.ex_add_client_to_target(target, 'FA.Linux', '14 Day Storage Policy',
+                                                '12AM - 6AM', 'ON_FAILURE', 'nobody@example.com')
+        )
+
+    def test_ex_get_backup_details_for_target(self):
+        target = self.driver.list_targets()[0]
+        response = self.driver.ex_get_backup_details_for_target(target)
+        self.assertEqual(response.service_plan, 'Enterprise')
+        client = response.clients[0]
+        self.assertEqual(client.type, 'FA.Linux')
+        self.assertEqual(client.running_job.percentage, 5)
+
     def test_ex_list_available_client_types(self):
         target = self.driver.list_targets()[0]
         answer = self.driver.ex_list_available_client_types(target)
@@ -150,11 +165,32 @@ class DimensionDataMockHttp(MockHttp):
             'oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_client_schedulePolicy.xml')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
+    def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_client(
+            self, method, url, body, headers):
+        if method == 'POST':
+            body = self.fixtures.load(
+                'oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_client_SUCCESS_PUT.xml')
+            return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+        else:
+            raise ValueError("Unknown Method {0}".format(method))
+
     def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup(
             self, method, url, body, headers):
-        body = self.fixtures.load(
-            'oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup.xml')
-        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+        if method == 'POST':
+            body = self.fixtures.load(
+                'oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_ENABLE.xml')
+            return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+        elif method == 'GET':
+            if url.endswith('disable'):
+                body = self.fixtures.load(
+                    'oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_DISABLE.xml')
+                return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+            body = self.fixtures.load(
+                'oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_INFO.xml')
+            return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+        else:
+            raise ValueError("Unknown Method {0}".format(method))
 
     def _oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_e75ead52_692f_4314_8725_c8a4f4d13a87_backup_EXISTS(
             self, method, url, body, headers):


Mime
View raw message