You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2016/07/02 09:53:25 UTC

[3/6] libcloud git commit: add tests for temporary token support on EC2NodeDriver

add tests for temporary token support on EC2NodeDriver

Closes #820

Signed-off-by: Tomaz Muraus <to...@tomaz.me>


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

Branch: refs/heads/trunk
Commit: 74b5469a9355dc2aacaae4243b2a239387aaca08
Parents: c1ba3bb
Author: Alejandro Gonz�lez <al...@intelygenz.com>
Authored: Thu Jun 30 08:44:02 2016 +0200
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Sat Jul 2 11:42:43 2016 +0200

----------------------------------------------------------------------
 libcloud/test/compute/test_ec2.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/74b5469a/libcloud/test/compute/test_ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ec2.py b/libcloud/test/compute/test_ec2.py
index c1bb55b..04c7335 100644
--- a/libcloud/test/compute/test_ec2.py
+++ b/libcloud/test/compute/test_ec2.py
@@ -85,6 +85,21 @@ class EC2Tests(LibcloudTestCase, TestCaseMixin):
         self.driver = EC2NodeDriver(*EC2_PARAMS,
                                     **{'region': self.region})
 
+    def test_instantiate_driver_with_token(self):
+        token = 'temporary_credentials_token'
+        driver = EC2NodeDriver(*EC2_PARAMS, **{'region': self.region, 'token': token})
+        self.assertTrue(hasattr(driver, 'token'), 'Driver has no attribute token')
+        self.assertEquals(token, driver.token, "Driver token does not match with provided token")
+
+    def test_driver_with_token_signature_version(self):
+        token = 'temporary_credentials_token'
+        driver = EC2NodeDriver(*EC2_PARAMS, **{'region': self.region, 'token': token})
+        kwargs = driver._ex_connection_class_kwargs()
+        self.assertIn('signature_version', kwargs)
+        self.assertEquals('4', kwargs['signature_version'], 'Signature version is not 4 with temporary credentials')
+
+
+
     def test_create_node(self):
         image = NodeImage(id='ami-be3adfd7',
                           name=self.image_name,