Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
- Allow social login (eg Google, Facebook, Twitter, etc), check out
[fastsapi-sso](https://github.com/tomasvotava/fastapi-sso) for this.
- Add API key management to the CLI too, working on both user and global scope.
- Implement password complexity checks (length, character mix, zxcvbn strength).
Store password history in a dedicated table (user_password_history) with
user_id, password_hash, and created_at fields (hash format identical to the
current password). On password change, forbid reuse of the last N passwords
(e.g. 3–5) by verifying against recent hashes. Maintain this as a sliding
window by pruning older entries so only the most recent N are kept.

## Testing

Expand Down
10 changes: 2 additions & 8 deletions tests/cli/test_cli_custom_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,10 @@ def test_no_command_should_give_help(self, runner: CliRunner) -> None:
assert all(command in result.output for command in command_list)

# ----------------------- test the 'init' function ----------------------- #
@pytest.mark.xfail
def test_init_function(self, mocker, fs) -> None:
"""Test that running 'init' should create a default metadata.

We use 'os.path' to check for the existence of the file, as the
filesystem mock does not work with Path objects created outside of
the test function (though seems to work in Python >=3.10).
We use 'os.path' to check for the existence of the file.
"""
metadata_file_path = str(self.home_dir / self.metadata_file)
fs.create_dir(str(self.home_dir))
Expand All @@ -124,13 +121,10 @@ def test_init_function(self, mocker, fs) -> None:
mock_get_config_path.assert_called_once()
assert os.path.exists(metadata_file_path) # noqa: PTH110

@pytest.mark.xfail
def test_init_function_with_existing_metadata(self, fs, mocker) -> None:
"""Test that running 'init' should overwrite existing metadata.

We use 'os.path' to check for the existence of the file, as the
filesystem mock does not work with Path objects created outside of
the test function (though seems to work in Python >=3.10).
We use 'os.path' to check for the existence of the file.
"""
# Setup
fs.create_dir(str(self.home_dir))
Expand Down
17 changes: 0 additions & 17 deletions tests/cli/test_cli_db_seed.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

# ruff: noqa: S105
import csv
import sys
from pathlib import Path

import pytest
Expand All @@ -25,10 +24,6 @@ class TestSeedCommand:
seed_users_path = "app.commands.db._seed_users_from_csv"
aiorun_path = "app.commands.db.aiorun"

@pytest.mark.xfail(
sys.version_info < (3, 10),
reason="Fails under Python <3.10, testing issue not a code issue.",
)
def test_seed_no_force_cancels(self, mocker, tmp_path) -> None:
"""Test that running 'seed' without --force cancels the operation."""
# Create a dummy CSV file
Expand Down Expand Up @@ -65,10 +60,6 @@ def test_seed_no_force_cancels(self, mocker, tmp_path) -> None:
# Verify seed function was never called
seed_mock.assert_not_called()

@pytest.mark.xfail(
sys.version_info < (3, 10),
reason="Fails under Python <3.10, testing issue not a code issue.",
)
def test_seed_with_force(self, mocker, tmp_path) -> None:
"""Test that running 'seed' with --force seeds the database."""
# Create a dummy CSV file
Expand Down Expand Up @@ -103,10 +94,6 @@ def test_seed_with_force(self, mocker, tmp_path) -> None:
# Verify seed function was called with correct arguments
seed_mock.assert_called_once_with(dummy_file)

@pytest.mark.xfail(
sys.version_info < (3, 10),
reason="Fails under Python <3.10, testing issue not a code issue.",
)
def test_seed_with_confirmation(self, mocker, tmp_path) -> None:
"""Test that running 'seed' with confirmation seeds the database."""
# Create a dummy CSV file
Expand Down Expand Up @@ -142,10 +129,6 @@ def test_seed_with_confirmation(self, mocker, tmp_path) -> None:
# Verify seed function was called with correct arguments
seed_mock.assert_called_once_with(dummy_file)

@pytest.mark.xfail(
sys.version_info < (3, 10),
reason="Fails under Python <3.10, testing issue not a code issue.",
)
def test_seed_missing_specified_file(self) -> None:
"""Test running 'seed' with a non-existent file fails with an error."""
# Use a path that definitely doesn't exist
Expand Down
Loading