Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit 32a04e64 authored by Dorian Turba's avatar Dorian Turba
Browse files

add tag only option test

parent 3c72da0c
No related branches found
No related tags found
No related merge requests found
...@@ -102,7 +102,8 @@ def publish( ...@@ -102,7 +102,8 @@ def publish(
post( post(
project_, project_,
changelog_entry, ref, changelog_entry,
ref,
target[tag_only], target[tag_only],
) )
......
...@@ -7,6 +7,7 @@ import pathlib ...@@ -7,6 +7,7 @@ import pathlib
import click.testing import click.testing
import pytest import pytest
import pytest_mock import pytest_mock
import release_by_changelog.services.gitlab
import typer.testing import typer.testing
from release_by_changelog.app import app as rbc_app from release_by_changelog.app import app as rbc_app
...@@ -325,3 +326,8 @@ def fake_post() -> collections.abc.Callable: ...@@ -325,3 +326,8 @@ def fake_post() -> collections.abc.Callable:
def successful_gitlab_interaction(mocker: pytest_mock.MockFixture) -> None: def successful_gitlab_interaction(mocker: pytest_mock.MockFixture) -> None:
mocker.patch("gitlab.Gitlab.http_get", side_effect=fake_get()) mocker.patch("gitlab.Gitlab.http_get", side_effect=fake_get())
mocker.patch("gitlab.Gitlab.http_post", side_effect=fake_post()) mocker.patch("gitlab.Gitlab.http_post", side_effect=fake_post())
@pytest.fixture(autouse=True)
def clear_cached_functions() -> None:
release_by_changelog.services.gitlab.get_project.cache_clear()
...@@ -26,3 +26,37 @@ def test_release( ...@@ -26,3 +26,37 @@ def test_release(
in result.output in result.output
) )
assert "Release created: 1.0.0" in result.output assert "Release created: 1.0.0" in result.output
@pytest.mark.usefixtures("successful_gitlab_interaction")
def test_tag(
app: collections.abc.Callable[[list[str]], click.testing.Result],
) -> None:
result = app(
[
"--changelog-path",
"FILE",
"--token",
"TOKEN",
"--host",
"HOST",
"--tag-only",
"3",
"main",
]
)
assert result.exit_code == 0, result.stdout
assert "Look for local FILE" in result.output
assert (
"Local FILE file not found, looking for file in the remote project files"
in result.output
)
assert "Retrieving project 3 from HOST" in result.output
assert "Project found: diaspora/Diaspora Project Site" in result.output
assert "FILE found in the remote project files" in result.output
assert "Found changelog entry: 1.0.0" in result.output
assert (
"Creating release 1.0.0 for project diaspora/Diaspora Project Site"
in result.output
)
assert "Release created: 1.0.0" in result.output
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment