コード例 #1
0
import shutil
import sys
import tempfile

APP_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
CLIENT_DIR = os.path.join(os.path.dirname(os.path.dirname(APP_DIR)), 'client')
sys.path.insert(0, APP_DIR)

sys.path.insert(0, CLIENT_DIR)
from third_party.depot_tools import fix_encoding

sys.path.pop(0)

import test_env

test_env.setup_test_env()

from tool_support import local_app


class LocalServers(object):
    """Local Swarming and Isolate servers."""
    def __init__(self, listen_all):
        self._isolate_server = None
        self._swarming_server = None
        self._listen_all = listen_all

    @property
    def isolate_server(self):
        return self._isolate_server
コード例 #2
0
ファイル: acl_test.py プロジェクト: rmistry/luci-py
#!/usr/bin/env python
# Copyright 2015 The Swarming Authors. All rights reserved.
# Use of this source code is governed by the Apache v2.0 license that can be
# found in the LICENSE file.

from test_env import future
import test_env
test_env.setup_test_env()

from test_support import test_case
import mock

from components import auth
from components.config.proto import project_config_pb2
from components.config.proto import service_config_pb2

import acl
import projects
import services
import storage


class AclTestCase(test_case.TestCase):
  def setUp(self):
    super(AclTestCase, self).setUp()
    self.mock(auth, 'get_current_identity', mock.Mock())
    auth.get_current_identity.return_value = auth.Anonymous
    self.mock(auth, 'is_admin', lambda *_: False)
    self.mock(auth, 'is_group_member', mock.Mock(return_value=False))
    self.mock(services, 'get_service_async', mock.Mock())
    services.get_service_async.side_effect = lambda sid: future(None)