refactor: some minor cleanup
This commit is contained in:
parent
307ca38ecc
commit
858d127246
12 changed files with 84 additions and 59 deletions
|
|
@ -3,6 +3,7 @@ import json
|
|||
|
||||
import server
|
||||
from providers.base import Provider, ProviderTokens
|
||||
from utils.env import parse_int_env
|
||||
|
||||
|
||||
class FakeRequest:
|
||||
|
|
@ -66,17 +67,17 @@ def _response_json(resp) -> dict:
|
|||
|
||||
def test_parse_int_env_defaults(monkeypatch):
|
||||
monkeypatch.delenv("X_TEST", raising=False)
|
||||
assert server._parse_int_env("X_TEST", 10, 1, 20) == 10
|
||||
assert parse_int_env("X_TEST", 10, 1, 20) == 10
|
||||
|
||||
|
||||
def test_parse_int_env_invalid(monkeypatch):
|
||||
monkeypatch.setenv("X_TEST", "abc")
|
||||
assert server._parse_int_env("X_TEST", 10, 1, 20) == 10
|
||||
assert parse_int_env("X_TEST", 10, 1, 20) == 10
|
||||
|
||||
|
||||
def test_parse_int_env_out_of_range(monkeypatch):
|
||||
monkeypatch.setenv("X_TEST", "999")
|
||||
assert server._parse_int_env("X_TEST", 10, 1, 20) == 10
|
||||
assert parse_int_env("X_TEST", 10, 1, 20) == 10
|
||||
|
||||
|
||||
def test_build_limit_fields():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue