|
1 | | -# from __future__ import annotations |
| 1 | +from __future__ import annotations |
2 | 2 |
|
3 | | -# from typing import TYPE_CHECKING |
| 3 | +from typing import TYPE_CHECKING |
4 | 4 |
|
5 | | -# import pytest |
| 5 | +import pytest |
6 | 6 |
|
7 | | -# from infrahub_sdk.testing.docker import TestInfrahubDockerClient |
8 | | -# from infrahub_sdk.testing.repository import GitRepo |
9 | | -# from infrahub_sdk.utils import get_fixtures_dir |
| 7 | +from infrahub_sdk.testing.docker import TestInfrahubDockerClient |
| 8 | +from infrahub_sdk.testing.repository import GitRepo |
| 9 | +from infrahub_sdk.utils import get_fixtures_dir |
10 | 10 |
|
11 | | -# if TYPE_CHECKING: |
12 | | -# from infrahub_sdk import InfrahubClient |
| 11 | +if TYPE_CHECKING: |
| 12 | + from infrahub_sdk import InfrahubClient |
13 | 13 |
|
14 | 14 |
|
15 | | -# class TestInfrahubRepository(TestInfrahubDockerClient): |
16 | | -# @pytest.fixture(scope="class") |
17 | | -# def infrahub_version(self) -> str: |
18 | | -# return "1.1.0" |
| 15 | +class TestInfrahubRepository(TestInfrahubDockerClient): |
| 16 | + @pytest.fixture(scope="class") |
| 17 | + def infrahub_version(self) -> str: |
| 18 | + return "1.1.0" |
19 | 19 |
|
20 | | -# async def test_add_repository(self, client: InfrahubClient, remote_repos_dir): |
21 | | -# src_directory = get_fixtures_dir() / "integration/mock_repo" |
22 | | -# repo = GitRepo(name="mock_repo", src_directory=src_directory, dst_directory=remote_repos_dir) |
23 | | -# commit = repo._repo.git[repo._repo.git.head()] |
24 | | -# assert len(list(repo._repo.git.get_walker())) == 1 |
25 | | -# assert commit.message.decode("utf-8") == "First commit" |
| 20 | + async def test_add_repository(self, client: InfrahubClient, remote_repos_dir): |
| 21 | + src_directory = get_fixtures_dir() / "integration/mock_repo" |
| 22 | + repo = GitRepo(name="mock_repo", src_directory=src_directory, dst_directory=remote_repos_dir) |
| 23 | + commit = repo._repo.git[repo._repo.git.head()] |
| 24 | + assert len(list(repo._repo.git.get_walker())) == 1 |
| 25 | + assert commit.message.decode("utf-8") == "First commit" |
26 | 26 |
|
27 | | -# response = await repo.add_to_infrahub(client=client) |
28 | | -# assert response.get(f"{repo.type.value}Create", {}).get("ok") |
| 27 | + response = await repo.add_to_infrahub(client=client) |
| 28 | + assert response.get(f"{repo.type.value}Create", {}).get("ok") |
29 | 29 |
|
30 | | -# repos = await client.all(kind=repo.type) |
31 | | -# assert repos |
| 30 | + repos = await client.all(kind=repo.type) |
| 31 | + assert repos |
0 commit comments