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 2020/03/10 22:07:26 UTC

[libcloud] 03/05: Add a test case for invalid project id being specified.

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 <to...@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):