Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean Caillé committed Aug 19, 2024
1 parent a02c2fa commit 3aed1a0
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from pathlib import Path

import pytest
from requests_mock import Mocker

from kraken.core import BuildError
from kraken.core.testing import kraken_ctx, kraken_project
Expand All @@ -37,6 +38,7 @@ class CargoRepositoryWithAuth:
creds: tuple[str, str] | None
token: str | None


def skip_publish_lib(repository: CargoRepositoryWithAuth, tempdir: Path) -> None:
lib_dir = tempdir.joinpath("cargo-hello-world-lib")
shutil.copytree(example_dir("cargo-hello-world-lib"), lib_dir)
Expand Down Expand Up @@ -64,7 +66,7 @@ def skip_publish_lib(repository: CargoRepositoryWithAuth, tempdir: Path) -> None
cargo_check_toolchain_version(minimal_version="1.60")
publish_task = cargo_publish(
cargo_registry_id,
version='0.1.0',
version="0.1.0",
cargo_toml_file=project1.directory.joinpath("Cargo.toml"),
)
graph = project1.context.execute(["publish"])
Expand Down Expand Up @@ -185,20 +187,20 @@ def private_registry(docker_service_manager: DockerServiceManager) -> str:
time.sleep(5)
return index_url


def test__private_cargo_registry_publish_and_consume(tempdir: Path, private_registry: str) -> None:
repository = CargoRepositoryWithAuth(
"kraken-std-cargo-integration-test", private_registry, None, "xxxxxxxxxxxxxxxxxxxxxx"
)
publish_lib_and_build_app(repository, tempdir)

def test__mock_cargo_registry_skips_publish_if_exists(tempdir: Path, requests_mock) -> None:

def test__mock_cargo_registry_skips_publish_if_exists(tempdir: Path, requests_mock: Mocker) -> None:
registry_url = "http://0.0.0.0:35510"
index_url = f"sparse+{registry_url}/"

requests_mock.get(f"{registry_url}/config.json", text="{}")
requests_mock.get(f"{registry_url}/he/ll/hello-world-lib", text='{"vers": "0.1.0"}')

repository = CargoRepositoryWithAuth(
"kraken-std-cargo-integration-test", index_url, None, "xxxxxxxxxxxxxxxxxxxxxx"
)
repository = CargoRepositoryWithAuth("kraken-std-cargo-integration-test", index_url, None, "xxxxxxxxxxxxxxxxxxxxxx")
skip_publish_lib(repository, tempdir)

0 comments on commit 3aed1a0

Please sign in to comment.