This repository has been archived by the owner on Jan 16, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
59 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import pytest | ||
from django.test.utils import override_settings | ||
|
||
from collectfast.settings import _get_setting | ||
|
||
|
||
@override_settings(FOO=2) | ||
def test_get_setting_returns_valid_value(): | ||
assert 2 == _get_setting(int, "FOO", 1) | ||
|
||
|
||
def test_get_setting_returns_default_value_for_missing_setting(): | ||
assert 1 == _get_setting(int, "FOO", 1) | ||
|
||
|
||
@override_settings(FOO="bar") | ||
def test_get_setting_raises_for_invalid_type(): | ||
with pytest.raises(ValueError): | ||
_get_setting(int, "FOO", 1) |