@@ -527,13 +527,65 @@ def tearDown(self):
527527 super (TestShellCli , self ).tearDown ()
528528 os .environ = self .orig_env
529529
530- def test_shell_args (self ):
530+ def test_shell_args_no_options (self ):
531531 _shell = make_shell ()
532532 with mock .patch ("openstackclient.shell.OpenStackShell.initialize_app" ,
533533 self .app ):
534534 fake_execute (_shell , "list user" )
535535 self .app .assert_called_with (["list" , "user" ])
536536
537+ def test_shell_args_ca_options (self ):
538+ _shell = make_shell ()
539+
540+ # NOTE(dtroyer): The commented out asserts below are the desired
541+ # behaviour and will be uncommented when the
542+ # handling for --verify and --insecure is fixed.
543+
544+ # Default
545+ fake_execute (_shell , "list user" )
546+ self .assertIsNone (_shell .options .verify )
547+ self .assertIsNone (_shell .options .insecure )
548+ self .assertEqual ('' , _shell .options .os_cacert )
549+ self .assertTrue (_shell .verify )
550+
551+ # --verify
552+ fake_execute (_shell , "--verify list user" )
553+ self .assertTrue (_shell .options .verify )
554+ self .assertIsNone (_shell .options .insecure )
555+ self .assertEqual ('' , _shell .options .os_cacert )
556+ self .assertTrue (_shell .verify )
557+
558+ # --insecure
559+ fake_execute (_shell , "--insecure list user" )
560+ self .assertIsNone (_shell .options .verify )
561+ self .assertTrue (_shell .options .insecure )
562+ self .assertEqual ('' , _shell .options .os_cacert )
563+ self .assertFalse (_shell .verify )
564+
565+ # --os-cacert
566+ fake_execute (_shell , "--os-cacert foo list user" )
567+ self .assertIsNone (_shell .options .verify )
568+ self .assertIsNone (_shell .options .insecure )
569+ self .assertEqual ('foo' , _shell .options .os_cacert )
570+ self .assertTrue (_shell .verify )
571+
572+ # --os-cacert and --verify
573+ fake_execute (_shell , "--os-cacert foo --verify list user" )
574+ self .assertTrue (_shell .options .verify )
575+ self .assertIsNone (_shell .options .insecure )
576+ self .assertEqual ('foo' , _shell .options .os_cacert )
577+ self .assertTrue (_shell .verify )
578+
579+ # --os-cacert and --insecure
580+ # NOTE(dtroyer): This really is a bogus combination, the default is
581+ # to follow the requests.Session convention and let
582+ # --os-cacert override --insecure
583+ fake_execute (_shell , "--os-cacert foo --insecure list user" )
584+ self .assertIsNone (_shell .options .verify )
585+ self .assertTrue (_shell .options .insecure )
586+ self .assertEqual ('foo' , _shell .options .os_cacert )
587+ self .assertTrue (_shell .verify )
588+
537589 def test_default_env (self ):
538590 flag = ""
539591 kwargs = {
0 commit comments