blob: b53f9a36892a04553f05b699337ea0644bcbaf86 [file] [log] [blame]
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import os
from recipe_engine import recipe_test_api
# Path to the production trees file. We need to use system os.path to make this
# available as test data whereever the simulation is run.
PROD_TREES_FILE = os.path.normpath(
'..', '..', 'gatekeeper_trees.json'))
class GatekeeperTestApi(recipe_test_api.RecipeTestApi):
def fake_test_data(self, data=None):
if not data:
data = self.fake_test_json()
return self.m.json.output(data)
def fake_test_json(self):
return {
'blink': {
'build-db': 'blink_build_db.json',
'masters': {
'': ["*"],
'filter-domain': '',
'open-tree': True,
'password-file': '.blink_status_password',
'revision-properties': 'got_revision',
'set-status': True,
'sheriff-url': '',
'status-url': '',
'status-user': '',
'track-revisions': True,
'use-project-email-address': True,
'chromium': {},
def infra_config_data(self):
return self.m.json.output({
'foobar': {
'config': 'foobar/tree_closers.json',
def gitiles_config_data(self):
return self.m.json.output({
'foobar': {
'gitiles-config': {
'repo_url': '',
'ref': 'refs/heads/baz',
'path': 'biz/buz.json',
def production_data(self):
with open(PROD_TREES_FILE) as f:
return self.m.json.output(json.load(f))