@@ -35,11 +35,14 @@ class TestConfiguration(utils.TestCommand):
3535 fakes .REGION_NAME ,
3636 )
3737
38- opts = [mock .Mock (secret = True , dest = "password" ),
39- mock .Mock (secret = True , dest = "token" )]
38+ opts = [
39+ mock .Mock (secret = True , dest = "password" ),
40+ mock .Mock (secret = True , dest = "token" ),
41+ ]
4042
41- @mock .patch ("keystoneauth1.loading.base.get_plugin_options" ,
42- return_value = opts )
43+ @mock .patch (
44+ "keystoneauth1.loading.base.get_plugin_options" , return_value = opts
45+ )
4346 def test_show (self , m_get_plugin_opts ):
4447 arglist = []
4548 verifylist = [('mask' , True )]
@@ -51,12 +54,14 @@ def test_show(self, m_get_plugin_opts):
5154 self .assertEqual (self .columns , columns )
5255 self .assertEqual (self .datalist , data )
5356
54- @mock .patch ("keystoneauth1.loading.base.get_plugin_options" ,
55- return_value = opts )
57+ @mock .patch (
58+ "keystoneauth1.loading.base.get_plugin_options" , return_value = opts
59+ )
5660 def test_show_unmask (self , m_get_plugin_opts ):
5761 arglist = ['--unmask' ]
5862 verifylist = [('mask' , False )]
5963 cmd = configuration .ShowConfiguration (self .app , None )
64+
6065 parsed_args = self .check_parser (cmd , arglist , verifylist )
6166
6267 columns , data = cmd .take_action (parsed_args )
@@ -71,15 +76,49 @@ def test_show_unmask(self, m_get_plugin_opts):
7176 )
7277 self .assertEqual (datalist , data )
7378
74- @mock .patch ("keystoneauth1.loading.base.get_plugin_options" ,
75- return_value = opts )
76- def test_show_mask (self , m_get_plugin_opts ):
79+ @mock .patch (
80+ "keystoneauth1.loading.base.get_plugin_options" , return_value = opts
81+ )
82+ def test_show_mask_with_cloud_config (self , m_get_plugin_opts ):
7783 arglist = ['--mask' ]
7884 verifylist = [('mask' , True )]
85+ self .app .client_manager .configuration_type = "cloud_config"
7986 cmd = configuration .ShowConfiguration (self .app , None )
87+
8088 parsed_args = self .check_parser (cmd , arglist , verifylist )
8189
8290 columns , data = cmd .take_action (parsed_args )
8391
8492 self .assertEqual (self .columns , columns )
8593 self .assertEqual (self .datalist , data )
94+
95+ @mock .patch (
96+ "keystoneauth1.loading.base.get_plugin_options" , return_value = opts
97+ )
98+ def test_show_mask_with_global_env (self , m_get_plugin_opts ):
99+ arglist = ['--mask' ]
100+ verifylist = [('mask' , True )]
101+ self .app .client_manager .configuration_type = "global_env"
102+ column_list = (
103+ 'identity_api_version' ,
104+ 'password' ,
105+ 'region' ,
106+ 'token' ,
107+ 'username' ,
108+ )
109+ datalist = (
110+ fakes .VERSION ,
111+ configuration .REDACTED ,
112+ fakes .REGION_NAME ,
113+ configuration .REDACTED ,
114+ fakes .USERNAME ,
115+ )
116+
117+ cmd = configuration .ShowConfiguration (self .app , None )
118+
119+ parsed_args = self .check_parser (cmd , arglist , verifylist )
120+
121+ columns , data = cmd .take_action (parsed_args )
122+
123+ self .assertEqual (column_list , columns )
124+ self .assertEqual (datalist , data )
0 commit comments