libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [libcloud] 03/05: Add a test case for invalid project id being specified.
Date Tue, 10 Mar 2020 22:07:26 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 1daec1154492399c71c9f672a18b6c9d5d858d52
Author: Tomaz Muraus <tomaz@tomaz.me>
AuthorDate: Tue Mar 10 23:00:22 2020 +0100

    Add a test case for invalid project id being specified.
---
 libcloud/test/common/test_openstack_identity.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/libcloud/test/common/test_openstack_identity.py b/libcloud/test/common/test_openstack_identity.py
index 50a46f4..8c35e13 100644
--- a/libcloud/test/common/test_openstack_identity.py
+++ b/libcloud/test/common/test_openstack_identity.py
@@ -536,7 +536,7 @@ class OpenStackIdentity_3_0_Connection_OIDC_access_token_project_idTests(
                                                                                 domain_name='project_id2')
         self.auth_instance.auth_token = 'mock'
 
-    def test_authenticate(self):
+    def test_authenticate_valid_project_id(self):
         auth = OpenStackIdentity_3_0_Connection_OIDC_access_token(auth_url='http://none',
                                                                   user_id='idp',
                                                                   key='token',
@@ -545,6 +545,17 @@ class OpenStackIdentity_3_0_Connection_OIDC_access_token_project_idTests(
                                                                   domain_name='project_id2')
         auth.authenticate()
 
+    def test_authenticate_invalid_project_id(self):
+        auth = OpenStackIdentity_3_0_Connection_OIDC_access_token(auth_url='http://none',
+                                                                  user_id='idp',
+                                                                  key='token',
+                                                                  token_scope='project',
+                                                                  tenant_name="oidc",
+                                                                  domain_name='project_id100')
+
+        expected_msg = 'Project project_id100 not found'
+        self.assertRaisesRegex(ValueError, expected_msg, auth.authenticate)
+
 
 class OpenStackIdentity_2_0_Connection_VOMSTests(unittest.TestCase):
     def setUp(self):


Mime
View raw message