コード例 #1
0
def test_wrap_name_from_git(prefix, expected_prefix, suffix, expected_suffix):
    repo = 'repo'
    branch = 'branch'
    hash_size = 5
    # Amount of separators when joining all segments:
    #    repo, branch, hash, prefix, suffix
    num_separators = 4
    limit = len(suffix) + len(prefix) + hash_size + num_separators
    bc_name = wrap_name_from_git(prefix, suffix, repo, branch, limit=limit, hash_size=hash_size)

    assert bc_name.startswith(expected_prefix + '-')
    assert bc_name.endswith('-' + expected_suffix)

    assert len(bc_name) <= limit

    # Is this a valid name for OpenShift to use?
    valid = re.compile(BC_NAME_REGEX)
    assert valid.match(bc_name)
コード例 #2
0
ファイル: test_utils.py プロジェクト: vrutkovs/osbs-client
def test_wrap_name_from_git(prefix, expected_prefix, suffix, expected_suffix):
    repo = 'repo'
    branch = 'branch'
    hash_size = 5
    # Amount of separators when joining all segments:
    #    repo, branch, hash, prefix, suffix
    num_separators = 4
    limit = len(suffix) + len(prefix) + hash_size + num_separators
    bc_name = wrap_name_from_git(prefix, suffix, repo, branch, limit=limit, hash_size=hash_size)

    assert bc_name.startswith(expected_prefix + '-')
    assert bc_name.endswith('-' + expected_suffix)

    assert len(bc_name) <= limit

    # Is this a valid name for OpenShift to use?
    valid = re.compile(BC_NAME_REGEX)
    assert valid.match(bc_name)