Sha256: 1e9511d4f970b3caa7235ae5cad0042a5635baea8e91e7a2082040b41ac0c5ea

Contents?: true

Size: 1.36 KB

Versions: 8

Compression:

Stored size: 1.36 KB

Contents

# Copyright 2018 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.

DEPS = [
  'gitiles',
  'recipe_engine/properties',
  'recipe_engine/step',
]


def RunSteps(api):
  valid_urls = [
    'https://host/path/to/project',
    'http://host/path/to/project',
    'https://host/a/path/to/project',
    'https://host/path/to/project.git',
    'http://host/a/path/to/project',
    'host/a/path/to/project',
  ]
  for repo_url in valid_urls:
    host, project = api.gitiles.parse_repo_url(repo_url)
    assert host == 'host', host
    assert project == 'path/to/project', project

  invalid_urls = [
    'https://host/a/path/to/project?a=b',
    'https://host/path/to/project/+/master',
  ]
  for repo_url in invalid_urls:
    host, project = api.gitiles.parse_repo_url(repo_url)
    assert host is None
    assert project is None

  actual = api.gitiles.unparse_repo_url('host', 'path/to/project')
  expected = 'https://host/path/to/project'
  assert actual == expected

  actual = api.gitiles.canonicalize_repo_url('http://host/path/to/project')
  expected = 'https://host/path/to/project'
  assert actual == expected

  actual = api.gitiles.canonicalize_repo_url('http://unrecognized')
  expected = 'http://unrecognized'
  assert actual == expected


def GenTests(api):
  yield api.test('basic')

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
libv8-8.4.255.0.1 vendor/depot_tools/recipes/recipe_modules/gitiles/tests/parse_repo_url.py
libv8-8.4.255.0 vendor/depot_tools/recipes/recipe_modules/gitiles/tests/parse_repo_url.py
libv8-7.8.279.23.0beta1 vendor/depot_tools/recipes/recipe_modules/gitiles/tests/parse_repo_url.py
libv8-7.4.288.28.0beta1 vendor/depot_tools/recipes/recipe_modules/gitiles/tests/parse_repo_url.py
libv8-7.3.492.27.3beta1 vendor/depot_tools/recipes/recipe_modules/gitiles/tests/parse_repo_url.py
libv8-7.3.492.27.1 vendor/depot_tools/recipes/recipe_modules/gitiles/tests/parse_repo_url.py
libv8-7.3.492.27.0 vendor/depot_tools/recipes/recipe_modules/gitiles/tests/parse_repo_url.py
libv8-7.3.492.27.0beta1 vendor/depot_tools/recipes/recipe_modules/gitiles/tests/parse_repo_url.py