Пример #1
0
  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'))
Пример #2
0
    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')