예제 #1
0
    def test_repo_info(self):
        self.assertEqual(projects.get_repo("x"), (None, None))
        projects.update_import_info("x", projects.RepositoryType.GITILES, "http://localhost/x")
        # Second time for coverage.
        projects.update_import_info("x", projects.RepositoryType.GITILES, "http://localhost/x")
        self.assertEqual(projects.get_repo("x"), (projects.RepositoryType.GITILES, "http://localhost/x"))

        # Change it
        projects.update_import_info("x", projects.RepositoryType.GITILES, "http://localhost/y")
예제 #2
0
  def test_repo_info(self):
    self.assertEqual(projects.get_repo('x'), (None, None))
    projects.update_import_info(
        'x', projects.RepositoryType.GITILES, 'http://localhost/x')
    # Second time for coverage.
    projects.update_import_info(
        'x', projects.RepositoryType.GITILES, 'http://localhost/x')
    self.assertEqual(
        projects.get_repo('x'),
        (projects.RepositoryType.GITILES, 'http://localhost/x'))

    # Change it
    projects.update_import_info(
        'x', projects.RepositoryType.GITILES, 'http://localhost/y')
예제 #3
0
파일: api.py 프로젝트: pombreda/luci-py
def get_projects():
  """Returns list of projects with metadata and repo info.

  Does not return projects that have no repo information. It might happen due
  to eventual consistency.

  Caches results in main memory for 10 min.
  """
  result = []
  for p in projects.get_projects():
    repo_type, repo_url = projects.get_repo(p.id)
    if repo_type is None:
      # Not yet consistent.
      continue
    metadata = projects.get_metadata(p.id)
    result.append(Project(
        id=p.id,
        name=metadata.name or None,
        repo_type=repo_type,
        repo_url=repo_url,
    ))
  return result
예제 #4
0
파일: api.py 프로젝트: eakuefner/luci-py
def get_projects():
  """Returns list of projects with metadata and repo info.

  Does not return projects that have no repo information. It might happen due
  to eventual consistency.

  Caches results in main memory for 10 min.
  """
  result = []
  for p in projects.get_projects():
    repo_type, repo_url = projects.get_repo(p.id)
    if repo_type is None:
      # Not yet consistent.
      continue
    metadata = projects.get_metadata(p.id)
    result.append(Project(
        id=p.id,
        name=metadata.name or None,
        repo_type=repo_type,
        repo_url=repo_url,
    ))
  return result