You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by se...@apache.org on 2015/05/05 15:26:12 UTC

[19/50] cloudstack-ec2stack git commit: Fix snapshot tests

Fix snapshot tests


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

Branch: refs/heads/master
Commit: b6a48b93c5ee6677b931a8abcbaa81a3b06a0592
Parents: d027dfb
Author: BroganD1993 <da...@hotmail.com>
Authored: Wed Aug 6 19:50:46 2014 +0100
Committer: BroganD1993 <da...@hotmail.com>
Committed: Wed Aug 6 19:50:46 2014 +0100

----------------------------------------------------------------------
 ec2stack/providers/cloudstack/snapshots.py | 10 +++-------
 ec2stack/templates/create_snapshot.xml     |  2 +-
 ec2stack/templates/snapshots.xml           |  2 +-
 tests/snapshot_tests.py                    |  7 ++++---
 4 files changed, 9 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack-ec2stack/blob/b6a48b93/ec2stack/providers/cloudstack/snapshots.py
----------------------------------------------------------------------
diff --git a/ec2stack/providers/cloudstack/snapshots.py b/ec2stack/providers/cloudstack/snapshots.py
index a75a5fb..69e53ea 100644
--- a/ec2stack/providers/cloudstack/snapshots.py
+++ b/ec2stack/providers/cloudstack/snapshots.py
@@ -4,14 +4,10 @@
 """This module contains functions for handling requests in relation to snapshots.
 """
 
-import uuid
-
-from flask import current_app
-
 from ec2stack import errors
 from ec2stack import helpers
 from ec2stack.providers import cloudstack
-from ec2stack.providers.cloudstack import requester, zones
+from ec2stack.providers.cloudstack import requester
 
 
 @helpers.authentication_required
@@ -46,7 +42,7 @@ def _create_snapshot_response(response):
     @return: Response.
     """
 
-    response = response['snapshot']
+    response = response['vmsnapshot']
     return {
         'template_name_or_list': 'create_snapshot.xml',
         'response_type': 'CreateSnapshotResponse',
@@ -101,7 +97,7 @@ def describe_snapshots():
     """
     args = {'command': 'listSnapshots'}
     response = cloudstack.describe_item(
-        args, 'snapshot', errors.invalid_snapshot_id, 'SnapshotId'
+        args, 'vmsnapshot', errors.invalid_snapshot_id, 'SnapshotId'
     )
 
     return _describe_snapshot_response(

http://git-wip-us.apache.org/repos/asf/cloudstack-ec2stack/blob/b6a48b93/ec2stack/templates/create_snapshot.xml
----------------------------------------------------------------------
diff --git a/ec2stack/templates/create_snapshot.xml b/ec2stack/templates/create_snapshot.xml
index b7f6ce0..91ca1cb 100644
--- a/ec2stack/templates/create_snapshot.xml
+++ b/ec2stack/templates/create_snapshot.xml
@@ -2,7 +2,7 @@
 {% block response_content %}
    <snapshot>
       <snapshotId>{{ response.id }}</snapshotId>
-      <volumeId>{{ snapshot.volumeid }}</volumeId>
+      <volumeId>{{ response.volumeid }}</volumeId>
       <status>{{ response.state }}</status>
    </snapshot>
 {% endblock %}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack-ec2stack/blob/b6a48b93/ec2stack/templates/snapshots.xml
----------------------------------------------------------------------
diff --git a/ec2stack/templates/snapshots.xml b/ec2stack/templates/snapshots.xml
index d4a3cee..1560683 100644
--- a/ec2stack/templates/snapshots.xml
+++ b/ec2stack/templates/snapshots.xml
@@ -1,7 +1,7 @@
 {% extends "response.xml" %}
 {% block response_content %}
     <snapshotSet>
-        {% for snapshot in response.snapshot %}
+        {% for snapshot in response.vmsnapshot %}
         <item>
             <snapshotId>{{ snapshot.id }}</snapshotId>
             <volumeId>{{ snapshot.volumeid }}</volumeId>

http://git-wip-us.apache.org/repos/asf/cloudstack-ec2stack/blob/b6a48b93/tests/snapshot_tests.py
----------------------------------------------------------------------
diff --git a/tests/snapshot_tests.py b/tests/snapshot_tests.py
index a100252..ec9a842 100644
--- a/tests/snapshot_tests.py
+++ b/tests/snapshot_tests.py
@@ -55,7 +55,7 @@ class SnapshotTestCase(Ec2StackAppTestCase):
 
     def test_describe_snapshot_by_name(self):
         data = self.get_example_data()
-        data['Action'] = 'DescribeVpcs'
+        data['Action'] = 'DescribeSnapshots'
         data['SnapshotId'] = 'examplesnapshot'
         data['Signature'] = generate_signature(data, 'POST', 'localhost', '/')
 
@@ -71,13 +71,14 @@ class SnapshotTestCase(Ec2StackAppTestCase):
                 data=data
             )
 
+        print response.data
         self.assert_ok(response)
         assert 'DescribeSnapshotsResponse' in response.data
         assert 'examplesnapshot' in response.data
 
     def test_describe_snapshot_by_name_invalid_name(self):
         data = self.get_example_data()
-        data['Action'] = 'DescribeVpcs'
+        data['Action'] = 'DescribeSnapshots'
         data['SnapshotId'] = 'invalidsnapshot'
         data['Signature'] = generate_signature(data, 'POST', 'localhost', '/')
 
@@ -94,7 +95,7 @@ class SnapshotTestCase(Ec2StackAppTestCase):
             )
 
         self.assert_bad_request(response)
-        assert 'InvalidSnapshotID.NotFound' in response.data
+        assert 'InvalidSnapshot.NotFound' in response.data
 
     def test_delete_snapshot(self):
         data = self.get_example_data()