chore: update development dependencies and improve test coverage
Some checks failed
CI / lint-and-test (push) Failing after 11s
Some checks failed
CI / lint-and-test (push) Failing after 11s
- Upgraded `pytest-asyncio` to version 1.0 to ensure compatibility with the latest features and improvements. - Increased the coverage threshold in pytest configuration to 80%, enhancing the quality assurance process. - Added a new `conftest.py` file to manage shared fixtures and improve test organization. - Introduced multiple new test files to cover various components, ensuring comprehensive test coverage across the application. - Updated the `.coverage` file to reflect the latest coverage metrics.
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
"""Tests for config.is_admin and config.can_access_miniapp."""
|
||||
"""Tests for config.is_admin, config.can_access_miniapp, and require_bot_token."""
|
||||
|
||||
import pytest
|
||||
|
||||
import duty_teller.config as config
|
||||
|
||||
@@ -67,3 +69,18 @@ def test_is_admin_by_phone(monkeypatch):
|
||||
assert config.is_admin_by_phone("+7 900 111-11-11") is True
|
||||
assert config.is_admin_by_phone("79001234567") is False
|
||||
assert config.is_admin_by_phone(None) is False
|
||||
|
||||
|
||||
def test_require_bot_token_raises_system_exit_when_empty(monkeypatch):
|
||||
"""require_bot_token() raises SystemExit with message about BOT_TOKEN when empty."""
|
||||
monkeypatch.setattr(config, "BOT_TOKEN", "")
|
||||
with pytest.raises(SystemExit) as exc_info:
|
||||
config.require_bot_token()
|
||||
assert "BOT_TOKEN" in str(exc_info.value)
|
||||
assert exc_info.value.code != 0
|
||||
|
||||
|
||||
def test_require_bot_token_does_not_raise_when_set(monkeypatch):
|
||||
"""require_bot_token() does nothing when BOT_TOKEN is set."""
|
||||
monkeypatch.setattr(config, "BOT_TOKEN", "123:ABC")
|
||||
config.require_bot_token()
|
||||
|
||||
Reference in New Issue
Block a user