Commits: 3

Remove an implemented TODO comment

index 977745d..5874cff 100644
--- a/main.py
+++ b/main.py
@@ -163,7 +163,6 @@ class JokerRegistration(BaseModel):
=
=@app.post("/jokers/", status_code=201)
=def register_joker(registration: JokerRegistration) -> Joker:
-    # TODO: Hash passwords, write to DB, respond with a new user?
=    password = password_context.hash(registration.password)
=    with sqlite3.connect(DB_PATH) as db:
=        db.row_factory = sqlite3.Row

Upgrade dependencies

index 75d6975..3bb45b3 100644
--- a/flake.lock
+++ b/flake.lock
@@ -18,11 +18,11 @@
=        ]
=      },
=      "locked": {
-        "lastModified": 1748883665,
-        "narHash": "sha256-R0W7uAg+BLoHjMRMQ8+oiSbTq8nkGz5RDpQ+ZfxxP3A=",
+        "lastModified": 1752264895,
+        "narHash": "sha256-1zBPE/PNAkPNUsOWFET4J0cjlvziH8DOekesDmjND+w=",
=        "owner": "cachix",
=        "repo": "cachix",
-        "rev": "f707778d902af4d62d8dd92c269f8e70de09acbe",
+        "rev": "47053aef762f452e816e44eb9a23fbc3827b241a",
=        "type": "github"
=      },
=      "original": {
@@ -36,6 +36,7 @@
=      "inputs": {
=        "cachix": "cachix",
=        "flake-compat": "flake-compat",
+        "flake-parts": "flake-parts",
=        "git-hooks": "git-hooks",
=        "nix": "nix",
=        "nixpkgs": [
@@ -43,11 +44,11 @@
=        ]
=      },
=      "locked": {
-        "lastModified": 1757003908,
-        "narHash": "sha256-Op3cnPTav+ObcL4R4BGuWHEFxW6YS2A0aE3Av6sZN2g=",
+        "lastModified": 1758897340,
+        "narHash": "sha256-YCakDdXHLJ06xo48RN/w3B9MdS9VEmcBAlQYibocQLw=",
=        "owner": "cachix",
=        "repo": "devenv",
-        "rev": "ac8ebf17828c0e7d9be0270d359123fffcc6f066",
+        "rev": "2d0941e76e7d9c3a03d47d431f38cc3dd5f90f98",
=        "type": "github"
=      },
=      "original": {
@@ -76,16 +77,15 @@
=      "inputs": {
=        "nixpkgs-lib": [
=          "devenv",
-          "nix",
=          "nixpkgs"
=        ]
=      },
=      "locked": {
-        "lastModified": 1733312601,
-        "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
+        "lastModified": 1756770412,
+        "narHash": "sha256-+uWLQZccFHwqpGqr2Yt5VsW/PbeJVTn9Dk6SHWhNRPw=",
=        "owner": "hercules-ci",
=        "repo": "flake-parts",
-        "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
+        "rev": "4524271976b625a4a605beefd893f270620fd751",
=        "type": "github"
=      },
=      "original": {
@@ -125,11 +125,11 @@
=        ]
=      },
=      "locked": {
-        "lastModified": 1750779888,
-        "narHash": "sha256-wibppH3g/E2lxU43ZQHC5yA/7kIKLGxVEnsnVK1BtRg=",
+        "lastModified": 1758108966,
+        "narHash": "sha256-ytw7ROXaWZ7OfwHrQ9xvjpUWeGVm86pwnEd1QhzawIo=",
=        "owner": "cachix",
=        "repo": "git-hooks.nix",
-        "rev": "16ec914f6fb6f599ce988427d9d94efddf25fe6d",
+        "rev": "54df955a695a84cd47d4a43e08e1feaf90b1fd9b",
=        "type": "github"
=      },
=      "original": {
@@ -166,7 +166,10 @@
=          "devenv",
=          "flake-compat"
=        ],
-        "flake-parts": "flake-parts",
+        "flake-parts": [
+          "devenv",
+          "flake-parts"
+        ],
=        "git-hooks-nix": [
=          "devenv",
=          "git-hooks"
@@ -192,18 +195,18 @@
=      },
=      "original": {
=        "owner": "cachix",
-        "ref": "devenv-2.30",
+        "ref": "devenv-2.30.4",
=        "repo": "nix",
=        "type": "github"
=      }
=    },
=    "nixpkgs": {
=      "locked": {
-        "lastModified": 1755783167,
-        "narHash": "sha256-gj7qvMNz7YvhjYxNq4I370cAYIZEw2PbVs5BSwaLrD4=",
+        "lastModified": 1758532697,
+        "narHash": "sha256-bhop0bR3u7DCw9/PtLCwr7GwEWDlBSxHp+eVQhCW9t4=",
=        "owner": "cachix",
=        "repo": "devenv-nixpkgs",
-        "rev": "4a880fb247d24fbca57269af672e8f78935b0328",
+        "rev": "207a4cb0e1253c7658c6736becc6eb9cace1f25f",
=        "type": "github"
=      },
=      "original": {

Setup unit tests with Pytest

I'm focusing on the joker registration validation logic. It's not implemented yet, but there is a todo comment. and since it's a pure logic, it's an easy start.

index 73f8a94..9495fe0 100644
--- a/flake.nix
+++ b/flake.nix
@@ -22,6 +22,7 @@
=          ps.passlib
=          ps.bcrypt
=          ps.python-multipart
+          ps.pytest
=        ]);
=      in
=
new file mode 100644
index 0000000..7ddafc7
--- /dev/null
+++ b/test_joker_registration_validation.py
@@ -0,0 +1,10 @@
+from main import JokerRegistration
+
+
+def test_valid_registration():
+    """Happy path"""
+
+    payload = {"name": "Funny Guy", "password": "Jokes 4 you!"}
+    registration = JokerRegistration(**payload)
+    assert registration.name == "Funny Guy"
+    assert registration.password == "Jokes 4 you!"