def test_get_projects(self): self.provider.get_projects_async.return_value = ndb.Future() self.provider.get_projects_async.return_value.set_result([ { 'id': 'chromium', 'repo_type': 'GITILES', 'repo_url': 'https://chromium.googlesource.com/chromium/src', 'name': 'Chromium browser' }, { 'id': 'infra', 'repo_type': 'GITILES', 'repo_url': 'https://chromium.googlesource.com/infra/infra', }, ]) projects = config.get_projects() self.assertEqual(projects, [ config.Project( id='chromium', repo_type='GITILES', repo_url='https://chromium.googlesource.com/chromium/src', name='Chromium browser'), config.Project( id='infra', repo_type='GITILES', repo_url='https://chromium.googlesource.com/infra/infra', name=''), ])
def get_locations_to_index(): """Returns registered gitiles projects.""" for project in config.get_projects(): if project.repo_type != 'GITILES': continue try: loc = gitiles.Location.parse(project.repo_url) except ValueError: logging.exception( 'Could not parse project %s repo url: %s', project.id, project.repo_url) else: yield loc._replace(treeish='HEAD', path='/')