fastsmtp-cli 0.7.0__tar.gz → 0.7.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/PKG-INFO +1 -1
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/pyproject.toml +1 -1
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/src/fastsmtp_cli/__init__.py +1 -1
- fastsmtp_cli-0.7.1/tests/conftest.py +49 -0
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/tests/test_output.py +31 -0
- fastsmtp_cli-0.7.0/tests/conftest.py +0 -14
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/.gitignore +0 -0
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/LICENSE +0 -0
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/README.md +0 -0
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/src/fastsmtp_cli/client.py +0 -0
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/src/fastsmtp_cli/commands/__init__.py +0 -0
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/src/fastsmtp_cli/commands/auth.py +0 -0
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/src/fastsmtp_cli/commands/config.py +0 -0
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/src/fastsmtp_cli/commands/domains.py +0 -0
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/src/fastsmtp_cli/commands/operations.py +0 -0
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/src/fastsmtp_cli/commands/options.py +0 -0
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/src/fastsmtp_cli/commands/recipients.py +0 -0
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/src/fastsmtp_cli/commands/rules.py +0 -0
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/src/fastsmtp_cli/commands/users.py +0 -0
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/src/fastsmtp_cli/config.py +0 -0
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/src/fastsmtp_cli/main.py +0 -0
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/src/fastsmtp_cli/output.py +0 -0
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/tests/test_api_contract.py +0 -0
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/tests/test_cli_config.py +0 -0
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/tests/test_client.py +0 -0
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/tests/test_commands.py +0 -0
- {fastsmtp_cli-0.7.0 → fastsmtp_cli-0.7.1}/tests/test_commands_reconciliation.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: fastsmtp-cli
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.1
|
|
4
4
|
Summary: Remote CLI client for FastSMTP server
|
|
5
5
|
Project-URL: Homepage, https://jsenecal.github.io/fastsmtp/cli/fsmtp/
|
|
6
6
|
Project-URL: Documentation, https://jsenecal.github.io/fastsmtp/cli/fsmtp/
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""Shared test configuration for the CLI package.
|
|
2
|
+
|
|
3
|
+
``test_api_contract`` imports ``fastsmtp.main`` to build the server's OpenAPI
|
|
4
|
+
document, and that module resolves settings at import time. Without these
|
|
5
|
+
variables the import raises before any fixture argument can supply them, so the
|
|
6
|
+
contract tests error out whenever this package's tests run on their own rather
|
|
7
|
+
than as part of the full suite.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
|
|
12
|
+
import pytest
|
|
13
|
+
|
|
14
|
+
# Set required environment variables before any imports
|
|
15
|
+
os.environ.setdefault("FASTSMTP_ROOT_API_KEY", "test_root_api_key_12345")
|
|
16
|
+
os.environ.setdefault("FASTSMTP_DATABASE_URL", "sqlite+aiosqlite:///:memory:")
|
|
17
|
+
|
|
18
|
+
CONSOLE_WIDTH = 80
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@pytest.fixture(autouse=True)
|
|
22
|
+
def deterministic_console(monkeypatch):
|
|
23
|
+
"""Render as if piped to an 80-column pipe, whatever terminal ran the suite.
|
|
24
|
+
|
|
25
|
+
``fastsmtp_cli.output`` builds both consoles at module scope, so each one
|
|
26
|
+
resolves its colour system and its width from the environment on import.
|
|
27
|
+
Two variables then decide what every assertion in ``test_output`` sees:
|
|
28
|
+
|
|
29
|
+
* ``FORCE_COLOR`` - which editors and agent harnesses set routinely - makes
|
|
30
|
+
rich emit ANSI escapes even though pytest's captured stdout is no tty.
|
|
31
|
+
* ``COLUMNS`` decides whether a table cell is padded or truncated to an
|
|
32
|
+
ellipsis.
|
|
33
|
+
|
|
34
|
+
CI sets neither, so both were invisible there and failed a clean ``main``
|
|
35
|
+
on a developer's machine instead. See issue #159.
|
|
36
|
+
|
|
37
|
+
Pinning the attributes rather than deleting the environment variables is
|
|
38
|
+
deliberate: ``_color_system`` is resolved in ``Console.__init__`` and never
|
|
39
|
+
consulted again, so unsetting ``FORCE_COLOR`` from a fixture is already too
|
|
40
|
+
late for a console built at import time - and which module imported
|
|
41
|
+
``output`` first is not something this file can order. Mutating the two
|
|
42
|
+
console objects in place reaches every reference to them, including the
|
|
43
|
+
ones ``test_output`` imported by value.
|
|
44
|
+
"""
|
|
45
|
+
from fastsmtp_cli.output import console, error_console
|
|
46
|
+
|
|
47
|
+
for target in (console, error_console):
|
|
48
|
+
monkeypatch.setattr(target, "_color_system", None)
|
|
49
|
+
monkeypatch.setattr(target, "_width", CONSOLE_WIDTH)
|
|
@@ -6,6 +6,7 @@ import pytest
|
|
|
6
6
|
from fastsmtp_cli.output import (
|
|
7
7
|
_format_expiry,
|
|
8
8
|
console,
|
|
9
|
+
error_console,
|
|
9
10
|
field,
|
|
10
11
|
format_datetime,
|
|
11
12
|
format_deleted,
|
|
@@ -1390,3 +1391,33 @@ class TestServerTextEscaping:
|
|
|
1390
1391
|
output = capsys.readouterr().out
|
|
1391
1392
|
assert "(catch-all)" in output
|
|
1392
1393
|
assert "[dim]" not in output
|
|
1394
|
+
|
|
1395
|
+
|
|
1396
|
+
class TestOutputIsEnvironmentIndependent:
|
|
1397
|
+
"""Rendering must not depend on the terminal the suite happens to run in.
|
|
1398
|
+
|
|
1399
|
+
Both consoles are module-level, so they resolve their colour system and
|
|
1400
|
+
their width when ``output`` is imported - before any test runs, and from
|
|
1401
|
+
whatever environment the developer has. Two variables leak in:
|
|
1402
|
+
|
|
1403
|
+
* ``FORCE_COLOR``, which editors and agent harnesses set routinely, makes
|
|
1404
|
+
rich emit ANSI escapes even though pytest's captured stdout is not a
|
|
1405
|
+
tty. Assertions here match plain substrings, so they meet
|
|
1406
|
+
``\\x1b[1m[\\x1b[0mfrom, to, subject`` instead of ``[from, to, subject]``.
|
|
1407
|
+
* ``COLUMNS``, which decides whether a table cell is padded or truncated
|
|
1408
|
+
to an ellipsis.
|
|
1409
|
+
|
|
1410
|
+
Both used to fail a clean ``main`` outside CI. See issue #159.
|
|
1411
|
+
"""
|
|
1412
|
+
|
|
1413
|
+
def test_stdout_carries_no_ansi_escapes(self, capsys):
|
|
1414
|
+
print_info("hello")
|
|
1415
|
+
assert "\x1b[" not in capsys.readouterr().out
|
|
1416
|
+
|
|
1417
|
+
def test_stderr_carries_no_ansi_escapes(self, capsys):
|
|
1418
|
+
print_error("Invalid field 'x'. Valid fields: [from, to, subject]")
|
|
1419
|
+
assert "\x1b[" not in capsys.readouterr().err
|
|
1420
|
+
|
|
1421
|
+
def test_both_consoles_are_pinned_to_a_known_width(self):
|
|
1422
|
+
assert console.width == 80
|
|
1423
|
+
assert error_console.width == 80
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"""Shared test configuration for the CLI package.
|
|
2
|
-
|
|
3
|
-
``test_api_contract`` imports ``fastsmtp.main`` to build the server's OpenAPI
|
|
4
|
-
document, and that module resolves settings at import time. Without these
|
|
5
|
-
variables the import raises before any fixture argument can supply them, so the
|
|
6
|
-
contract tests error out whenever this package's tests run on their own rather
|
|
7
|
-
than as part of the full suite.
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
import os
|
|
11
|
-
|
|
12
|
-
# Set required environment variables before any imports
|
|
13
|
-
os.environ.setdefault("FASTSMTP_ROOT_API_KEY", "test_root_api_key_12345")
|
|
14
|
-
os.environ.setdefault("FASTSMTP_DATABASE_URL", "sqlite+aiosqlite:///:memory:")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|