tests: fix coverage

This commit is contained in:
Éloi Rivard 2025-01-10 11:56:24 +01:00
parent a25bfe0b3a
commit 9bbad786e3
No known key found for this signature in database
GPG key ID: 7EDA204EA57DD184
2 changed files with 6 additions and 1 deletions

View file

@ -2,6 +2,8 @@ import datetime
import json import json
from unittest import mock from unittest import mock
import pytest
from canaille.backends import ModelEncoder from canaille.backends import ModelEncoder
from canaille.commands import cli from canaille.commands import cli
@ -15,6 +17,9 @@ def test_serialize(user):
== '{"foo": "1970-01-01T00:00:00"}' == '{"foo": "1970-01-01T00:00:00"}'
) )
with pytest.raises(TypeError):
json.dumps({"foo": object()}, cls=ModelEncoder)
def test_get_list_models(testclient, backend, user): def test_get_list_models(testclient, backend, user):
"""Nominal case test for model get command.""" """Nominal case test for model get command."""

View file

@ -35,7 +35,7 @@ def test_edition(testclient, logged_user, admin, foo_group, bar_group, backend):
assert bar_group.members == [admin] assert bar_group.members == [admin]
assert "readonly" in res.form["groups"].attrs assert "readonly" in res.form["groups"].attrs
assert "readonly" in res.form["user_name"].attrs assert "readonly" in res.form["user_name"].attrs
res = testclient.get("/profile/user/settings", status=200) res = testclient.get("/profile/user/settings", status=200)
res.form["user_name"] = "user" res.form["user_name"] = "user"
res.form["password1"] = "i'm a little pea" res.form["password1"] = "i'm a little pea"