2020-08-18 08:32:47 +00:00
|
|
|
# MIT licensed
|
|
|
|
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
|
|
|
|
|
|
|
|
async def test_gitlab(get_version):
|
|
|
|
ver = await get_version("example", {
|
|
|
|
"source": "gitlab",
|
|
|
|
"gitlab": "gitlab-org/gitlab-test",
|
|
|
|
})
|
|
|
|
assert len(ver) == 8
|
|
|
|
assert ver.isdigit()
|
|
|
|
|
2021-03-18 05:18:03 +00:00
|
|
|
async def test_gitlab_blm(get_version):
|
|
|
|
# repo with a custom main branch
|
|
|
|
ver = await get_version("example", {
|
|
|
|
"source": "gitlab",
|
2021-05-06 04:44:55 +00:00
|
|
|
"gitlab": "asus-linux/asusctl",
|
2021-03-18 05:18:03 +00:00
|
|
|
})
|
|
|
|
assert len(ver) == 8
|
|
|
|
assert ver.isdigit()
|
|
|
|
|
2020-08-18 08:32:47 +00:00
|
|
|
async def test_gitlab_max_tag(get_version):
|
|
|
|
assert await get_version("example", {
|
|
|
|
"source": "gitlab",
|
|
|
|
"gitlab": "gitlab-org/gitlab-test",
|
|
|
|
"use_max_tag": True,
|
|
|
|
}) == "v1.1.1"
|
|
|
|
|
|
|
|
async def test_gitlab_max_tag_with_include(get_version):
|
|
|
|
assert await get_version("example", {
|
|
|
|
"source": "gitlab",
|
|
|
|
"gitlab": "gitlab-org/gitlab-test",
|
|
|
|
"use_max_tag": True,
|
|
|
|
"include_regex": r'v1\.0.*',
|
|
|
|
}) == "v1.0.0"
|
|
|
|
|
|
|
|
async def test_gitlab_max_tag_with_ignored(get_version):
|
|
|
|
assert await get_version("example", {
|
|
|
|
"source": "gitlab",
|
|
|
|
"gitlab": "gitlab-org/gitlab-test",
|
|
|
|
"use_max_tag": True,
|
|
|
|
"ignored": "v1.1.0 v1.1.1",
|
|
|
|
}) == "v1.0.0"
|
|
|
|
|