Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more unit tests for settings module #14

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
15 changes: 15 additions & 0 deletions tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,28 @@ def preferences() -> AppPreferences:
yield AppPreferences()


# Definition --------------------------------------


def test_prefs_are_registered() -> None:
"""Test if the preferences are registered properly or not"""

# At least one preference must be registered
assert len(PREF_DEF_REGISTRY) > 0, "No preference registered"


def test_invalid_pref_definition() -> None:
"""Test that error is raised if preference definition is invalid"""

with pytest.raises(TypeError):
# Declare a invalid preference definition
class InvalidPreference(Preference):
desc = "This is invalid definition and must throw exception"


# App Preferences ----------------------------------


def test_app_preference_getter_and_setters(preferences: AppPreferences):
"""Test if getting and setting preference is properly working or not."""

Expand Down
Loading