@@ -837,6 +837,20 @@ def test_image_list_status_option(self):
837837 status = 'active'
838838 )
839839
840+ def test_image_list_hidden_option (self ):
841+ arglist = [
842+ '--hidden' ,
843+ ]
844+ verifylist = [
845+ ('hidden' , True ),
846+ ]
847+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
848+
849+ columns , data = self .cmd .take_action (parsed_args )
850+ self .client .images .assert_called_with (
851+ is_hidden = True
852+ )
853+
840854 def test_image_list_tag_option (self ):
841855 arglist = [
842856 '--tag' , 'abc' ,
@@ -1439,6 +1453,60 @@ def test_image_set_numeric_options_to_zero(self):
14391453 )
14401454 self .assertIsNone (result )
14411455
1456+ def test_image_set_hidden (self ):
1457+ arglist = [
1458+ '--hidden' ,
1459+ '--public' ,
1460+ image_fakes .image_name ,
1461+ ]
1462+ verifylist = [
1463+ ('hidden' , True ),
1464+ ('public' , True ),
1465+ ('private' , False ),
1466+ ('image' , image_fakes .image_name ),
1467+ ]
1468+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
1469+
1470+ result = self .cmd .take_action (parsed_args )
1471+
1472+ kwargs = {
1473+ 'is_hidden' : True ,
1474+ 'visibility' : 'public' ,
1475+ }
1476+ # ImageManager.update(image, **kwargs)
1477+ self .client .update_image .assert_called_with (
1478+ self ._image .id ,
1479+ ** kwargs
1480+ )
1481+ self .assertIsNone (result )
1482+
1483+ def test_image_set_unhidden (self ):
1484+ arglist = [
1485+ '--unhidden' ,
1486+ '--public' ,
1487+ image_fakes .image_name ,
1488+ ]
1489+ verifylist = [
1490+ ('hidden' , False ),
1491+ ('public' , True ),
1492+ ('private' , False ),
1493+ ('image' , image_fakes .image_name ),
1494+ ]
1495+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
1496+
1497+ result = self .cmd .take_action (parsed_args )
1498+
1499+ kwargs = {
1500+ 'is_hidden' : False ,
1501+ 'visibility' : 'public' ,
1502+ }
1503+ # ImageManager.update(image, **kwargs)
1504+ self .client .update_image .assert_called_with (
1505+ self ._image .id ,
1506+ ** kwargs
1507+ )
1508+ self .assertIsNone (result )
1509+
14421510
14431511class TestImageShow (TestImage ):
14441512
0 commit comments