-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix AttributeError thrown by str.removeprefix when python < 3.9
- Loading branch information
Showing
3 changed files
with
28 additions
and
4 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,25 @@ | ||
from pinnwand.configuration import Configuration, ConfigurationProvider | ||
import tempfile | ||
import toml | ||
|
||
|
||
def test_load_environment_config(monkeypatch): | ||
monkeypatch.setenv("PINNWAND_SPAMSCORE", "29") | ||
config: Configuration = ConfigurationProvider.get_config(load_env=True) | ||
assert config.spamscore == 29 | ||
|
||
|
||
def test_load_file_config(): | ||
with tempfile.NamedTemporaryFile(suffix="", delete=False) as temp: | ||
|
||
props = toml.load(temp.name) | ||
url = "sqlite:///database.db" | ||
props["database_uri"] = url | ||
|
||
with open(temp.name, "w") as config_file: | ||
toml.dump(props, config_file) | ||
config: Configuration = ConfigurationProvider.get_config() | ||
|
||
config.load_config_file(temp.name) | ||
assert config.database_uri == url | ||
|