Compare commits

...

5 commits

Author SHA1 Message Date
595f93cb61 Fix formatting
All checks were successful
ci/woodpecker/push/tests Pipeline was successful
2025-02-28 08:25:58 +01:00
3e84b1dfed Include isort linting for ruff 2025-02-28 08:22:24 +01:00
76f80c5032 Remove dangling __init__.py file 2025-02-28 08:16:19 +01:00
9a50b78a16 Add a Dockerfile 2025-02-28 08:15:59 +01:00
df869b0828 Fixed linting warnings 2025-02-27 22:16:46 +01:00
5 changed files with 33 additions and 4 deletions

1
.dockerignore Normal file
View file

@ -0,0 +1 @@
tests

25
Dockerfile Normal file
View file

@ -0,0 +1,25 @@
FROM ghcr.io/astral-sh/uv:python3.11-bookworm
ENV UV_CACHE_DIR=/app/.cache/uv
RUN useradd --shell /bin/bash --uid 1000 transip_client
USER transip_client
WORKDIR /app
RUN mkdir --parents /app/.cache/uv
# only install dependencies
RUN --mount=type=cache,uid=1000,target=/app/.cache/uv \
--mount=type=bind,source=uv.lock,target=/app/uv.lock \
--mount=type=bind,source=pyproject.toml,target=/app/pyproject.toml \
uv sync --frozen --no-install-project
COPY pyproject.toml uv.lock /app
COPY transip_client /app/transip_client
# install dependencies + project
RUN --mount=type=cache,uid=1000,target=/app/.cache/uv uv sync --frozen
ENTRYPOINT ["uv", "run", "--", "transip-listen"]

View file

View file

@ -32,6 +32,9 @@ build-backend = 'setuptools.build_meta'
[tool.uv]
environments = ["sys_platform == 'linux'"]
[tool.ruff.lint]
select = ["E4", "E7", "E9", "F", "I"]
[tool.ruff.lint.isort]
lines-between-types=1
lines-after-imports=2

View file

@ -1,9 +1,9 @@
import json
import os
from unittest import TestCase, skip
from unittest.mock import call, patch, Mock
from pathlib import Path
from unittest import TestCase
from unittest.mock import Mock, call, patch
from click.testing import CliRunner
from requests import HTTPError
@ -225,7 +225,7 @@ class RunTestCase(TestCase):
self.assertEqual(result.exit_code, 0)
self.mocked_get.assert_called_with(
f"https://other-provider.com/domains/foobar.com/dns",
"https://other-provider.com/domains/foobar.com/dns",
headers={"Authorization": "Bearer token"},
)
@ -243,7 +243,7 @@ class RunTestCase(TestCase):
)
self.mocked_put.assert_called_with(
f"https://other-provider.com/domains/foobar.com/dns",
"https://other-provider.com/domains/foobar.com/dns",
data=expected_json,
headers={"Authorization": "Bearer token"},
)