@@ -150,8 +150,33 @@ def test_trailing_with_one_arg_works(self):
150150 self .assertEqual ('boris/search/another/path/segment/that runs on' , client ._trailing (self .template , 'ervicesNS/' ))
151151
152152 def test_trailing_with_n_args_works (self ):
153- self .assertEqual ('another/path/segment/that runs on' , client ._trailing (self .template , 'servicesNS/' , '/' , '/' ))
154-
153+ self .assertEqual (
154+ 'another/path/segment/that runs on' ,
155+ client ._trailing (self .template , 'servicesNS/' , '/' , '/' )
156+ )
157+
158+ class TestEntityNamespacing (testlib .SDKTestCase ):
159+ def test_proper_namespace_with_arguments (self ):
160+ entity = self .service .apps ['search' ]
161+ self .assertEquals ((None ,None ,"global" ), entity ._proper_namespace (sharing = "global" ))
162+ self .assertEquals ((None ,"search" ,"app" ), entity ._proper_namespace (sharing = "app" , app = "search" ))
163+ self .assertEquals (
164+ ("admin" , "search" , "user" ),
165+ entity ._proper_namespace (sharing = "user" , app = "search" , owner = "admin" )
166+ )
167+
168+ def test_proper_namespace_with_entity_namespace (self ):
169+ entity = self .service .apps ['search' ]
170+ namespace = (entity .access .owner , entity .access .app , entity .access .sharing )
171+ self .assertEquals (namespace , entity ._proper_namespace ())
172+
173+ def test_proper_namespace_with_service_namespace (self ):
174+ entity = client .Entity (self .service , client .PATH_APPS + "search" )
175+ del entity ._state ['access' ]
176+ namespace = (self .service .namespace .owner ,
177+ self .service .namespace .app ,
178+ self .service .namespace .sharing )
179+ self .assertEquals (namespace , entity ._proper_namespace ())
155180
156181if __name__ == "__main__" :
157182 try :
0 commit comments