libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [libcloud] 05/05: Add additional test case, use better method name.
Date Sun, 04 Oct 2020 17:09:06 GMT
This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit 0616c2e8b99736a63d1bee9c5bb4cbd602373712
Author: Tomaz Muraus <tomaz@tomaz.me>
AuthorDate: Sun Oct 4 19:07:54 2020 +0200

    Add additional test case, use better method name.
---
 libcloud/test/compute/test_gce.py | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/libcloud/test/compute/test_gce.py b/libcloud/test/compute/test_gce.py
index b740870..6a4cb56 100644
--- a/libcloud/test/compute/test_gce.py
+++ b/libcloud/test/compute/test_gce.py
@@ -63,7 +63,7 @@ class GCENodeDriverTest(GoogleTestCase, TestCaseMixin):
     def test_default_scopes(self):
         self.assertIsNone(self.driver.scopes)
 
-    def test_default_service_account(self):
+    def test_build_service_account_gce_struct_default_service_account(self):
         result = self.driver._build_service_accounts_gce_list(service_accounts=None)
         self.assertEqual(result, [
             {'email': 'default',
@@ -71,10 +71,23 @@ class GCENodeDriverTest(GoogleTestCase, TestCaseMixin):
              }
         ])
 
-    def test_no_service_account(self):
+    def test_build_service_account_gce_struct_no_service_account(self):
         result = self.driver._build_service_accounts_gce_list(service_accounts=[])
         self.assertEqual(result, [])
 
+    def test_build_service_account_gce_struct_custom_service_account(self):
+        data = [
+            {'email': '1', 'scopes': ['a']},
+            {'email': '2', 'scopes': ['b']}
+        ]
+        expected_result = [
+            {'email': '1', 'scopes': ['https://www.googleapis.com/auth/a']},
+            {'email': '2', 'scopes': ['https://www.googleapis.com/auth/b']}
+        ]
+
+        result = self.driver._build_service_accounts_gce_list(service_accounts=data)
+        self.assertEqual(result, expected_result)
+
     def test_timestamp_to_datetime(self):
         timestamp1 = '2013-06-26T10:05:19.340-07:00'
         datetime1 = datetime.datetime(2013, 6, 26, 17, 5, 19)


Mime
View raw message