Exemplo n.º 1
0
 def test_auth_plugin_invocation_without_username_with_v1(self, v1_client):
     self.make_env(exclude='OS_USERNAME')
     args = 'image-list'
     glance_shell = openstack_shell.OpenStackImagesShell()
     self.assertRaises(exc.CommandError, glance_shell.main, args.split())
Exemplo n.º 2
0
 def test_help(self):
     shell = openstack_shell.OpenStackImagesShell()
     argstr = 'help'
     actual = shell.main(argstr.split())
     self.assertEqual(0, actual)
Exemplo n.º 3
0
 def test_help_v2_no_schema(self):
     shell = openstack_shell.OpenStackImagesShell()
     argstr = '--os-image-api-version 2 help image-create'
     actual = shell.main(argstr.split())
     self.assertEqual(0, actual)
     self.assertNotIn('<unavailable>', actual)
Exemplo n.º 4
0
 def _mock_shell_setup(self):
     self.shell = openstack_shell.OpenStackImagesShell()
     self.shell._get_versioned_client = mock.create_autospec(
         self.shell._get_versioned_client,
         return_value=self.client,
         spec_set=True)
Exemplo n.º 5
0
 def test_help_unknown_command(self):
     shell = openstack_shell.OpenStackImagesShell()
     argstr = 'help foofoo'
     self.assertRaises(exc.CommandError, shell.main, argstr.split())
Exemplo n.º 6
0
 def test_api_discovery_failed_with_unversioned_auth_url(self, discover):
     args = ('--os-image-api-version 2 --os-auth-url %s image-list' %
             DEFAULT_UNVERSIONED_AUTH_URL)
     glance_shell = openstack_shell.OpenStackImagesShell()
     self.assertRaises(exc.CommandError, glance_shell.main, args.split())
Exemplo n.º 7
0
 def test_auth_plugin_invocation_with_v2(self, v2_client):
     args = '--os-image-api-version 2 image-list'
     glance_shell = openstack_shell.OpenStackImagesShell()
     glance_shell.main(args.split())
     self.assertEqual(1, self.v3_auth.call_count)
     self._assert_auth_plugin_args()
Exemplo n.º 8
0
 def test_auth_plugin_invocation_with_unversioned_auth_url_with_v2(
         self, v2_client, cache_schemas):
     args = ('--os-auth-url %s --os-image-api-version 2 '
             'image-list') % DEFAULT_UNVERSIONED_AUTH_URL
     glance_shell = openstack_shell.OpenStackImagesShell()
     glance_shell.main(args.split())
Exemplo n.º 9
0
 def test_auth_plugin_invocation_without_auth_url_with_v2(self, v2_client):
     self.make_env(exclude='OS_AUTH_URL')
     args = '--os-image-api-version 2 image-list'
     glance_shell = openstack_shell.OpenStackImagesShell()
     self.assertRaises(exc.CommandError, glance_shell.main, args.split())
Exemplo n.º 10
0
 def test_auth_plugin_invocation_with_unversioned_auth_url_with_v1(
         self, v1_client):
     args = ('--os-image-api-version 1 --os-auth-url %s image-list' %
             DEFAULT_UNVERSIONED_AUTH_URL)
     glance_shell = openstack_shell.OpenStackImagesShell()
     glance_shell.main(args.split())
Exemplo n.º 11
0
 def test_blank_call(self):
     shell = openstack_shell.OpenStackImagesShell()
     with mock.patch.object(shell, '_get_keystone_auth_plugin') as et_mock:
         actual = shell.main('')
         self.assertEqual(0, actual)
         self.assertFalse(et_mock.called)
Exemplo n.º 12
0
 def _mock_shell_setup(self):
     mocked_get_client = mock.MagicMock(return_value=self.client)
     self.shell = openstack_shell.OpenStackImagesShell()
     self.shell._get_versioned_client = mocked_get_client
Exemplo n.º 13
0
 def test_blank_call(self):
     shell = openstack_shell.OpenStackImagesShell()
     with mock.patch.object(shell, '_get_endpoint_and_token') as et_mock:
         actual = shell.main('')
         self.assertEqual(0, actual)
         self.assertFalse(et_mock.called)
Exemplo n.º 14
0
 def test_api_discovery_failed_with_unversioned_auth_url(
         self, ks_session, discover):
     args = '--os-auth-url %s image-list' % (
         keystone_client_fixtures.BASE_URL)
     glance_shell = openstack_shell.OpenStackImagesShell()
     self.assertRaises(exc.CommandError, glance_shell.main, args.split())