def test_has_project_access_no_access(self): self.set_up_identity() self.mock(api, 'get_project_config_async', mock.Mock()) api.get_project_config_async.return_value = ndb.Future() api.get_project_config_async.return_value.set_result( project_config_pb2.ProjectCfg(), # access not configured => internal ) self.assertFalse(config.has_project_access('chromium'))
def test_has_project_access_anon_identity(self): self.set_up_identity() self.mock(api, 'get_project_config_async', mock.Mock()) api.get_project_config_async.return_value = ndb.Future() api.get_project_config_async.return_value.set_result( project_config_pb2.ProjectCfg(access=['anonymous:anonymous'], )) self.assertTrue(config.has_project_access('chromium')) api.get_project_config_async.assert_called_once('chromium')