@@ -76,6 +76,58 @@ def test___delitem___miss(self):
7676 with self .assertRaises (KeyError ):
7777 del policy ['nonesuch' ]
7878
79+ def test_owners_getter (self ):
80+ from google .cloud .iam import OWNER_ROLE
81+ MEMBER = 'user:phred@example.com'
82+ policy = self ._make_one ()
83+ policy [OWNER_ROLE ] = [MEMBER ]
84+ self .assertIsInstance (policy .owners , frozenset )
85+ self .assertEqual (list (policy .owners ), [MEMBER ])
86+
87+ def test_owners_setter (self ):
88+ import warnings
89+ from google .cloud .iam import OWNER_ROLE
90+ MEMBER = 'user:phred@example.com'
91+ policy = self ._make_one ()
92+ with warnings .catch_warnings ():
93+ policy .owners = [MEMBER ]
94+ self .assertEqual (list (policy [OWNER_ROLE ]), [MEMBER ])
95+
96+ def test_editors_getter (self ):
97+ from google .cloud .iam import EDITOR_ROLE
98+ MEMBER = 'user:phred@example.com'
99+ policy = self ._make_one ()
100+ policy [EDITOR_ROLE ] = [MEMBER ]
101+ self .assertIsInstance (policy .editors , frozenset )
102+ self .assertEqual (list (policy .editors ), [MEMBER ])
103+
104+ def test_editors_setter (self ):
105+ import warnings
106+ from google .cloud .iam import EDITOR_ROLE
107+ MEMBER = 'user:phred@example.com'
108+ policy = self ._make_one ()
109+ with warnings .catch_warnings ():
110+ policy .editors = [MEMBER ]
111+ self .assertEqual (list (policy [EDITOR_ROLE ]), [MEMBER ])
112+
113+ def test_viewers_getter (self ):
114+ from google .cloud .iam import VIEWER_ROLE
115+ MEMBER = 'user:phred@example.com'
116+ policy = self ._make_one ()
117+ policy [VIEWER_ROLE ] = [MEMBER ]
118+ self .assertIsInstance (policy .viewers , frozenset )
119+ self .assertEqual (list (policy .viewers ), [MEMBER ])
120+
121+ def test_viewers_setter (self ):
122+ import warnings
123+ from google .cloud .iam import VIEWER_ROLE
124+ MEMBER = 'user:phred@example.com'
125+ policy = self ._make_one ()
126+ with warnings .catch_warnings ():
127+ warnings .simplefilter ('always' )
128+ policy .viewers = [MEMBER ]
129+ self .assertEqual (list (policy [VIEWER_ROLE ]), [MEMBER ])
130+
79131 def test_user (self ):
80132 EMAIL = 'phred@example.com'
81133 MEMBER = 'user:%s' % (EMAIL ,)
0 commit comments