def test_get_refs(self): storage.get_latest_async.return_value.set_result(''' refs { name: "refs/heads/master" } refs { name: "refs/heads/release42" config_path: "other" } ''') expected = project_config_pb2.RefsCfg(refs=[ project_config_pb2.RefsCfg.Ref(name='refs/heads/master'), project_config_pb2.RefsCfg.Ref(name='refs/heads/release42', config_path='other'), ], ) self.assertEqual(projects.get_refs('chromium'), expected.refs)
def test_get_refs(self): self.mock_latest_config( 'projects/chromium', ''' refs { name: "refs/heads/master" } refs { name: "refs/heads/release42" config_path: "other" } ''') expected = project_config_pb2.RefsCfg(refs=[ project_config_pb2.RefsCfg.Ref(name='refs/heads/master'), project_config_pb2.RefsCfg.Ref(name='refs/heads/release42', config_path='other'), ], ) self.assertEqual(projects.get_refs(['chromium']), {'chromium': expected.refs})
"""Provides info about projects (service tenants).""" import logging from google.appengine.ext import ndb from google.appengine.ext.ndb import msgprop from protorpc import messages from components import utils from components.config.proto import project_config_pb2 from components.config.proto import service_config_pb2 import common import storage DEFAULT_REF_CFG = project_config_pb2.RefsCfg( refs=[project_config_pb2.RefsCfg.Ref(name='refs/heads/master')]) class RepositoryType(messages.Enum): GITILES = 1 class ProjectImportInfo(ndb.Model): """Contains info how a project was imported. Entity key: Id is project id from the project registry. Has no parent. """ created_ts = ndb.DateTimeProperty(auto_now_add=True) repo_type = msgprop.EnumProperty(RepositoryType, required=True) repo_url = ndb.StringProperty(required=True)