-
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
2 changed files
with
29 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from pinnwand.configuration import Configuration | ||
import tempfile | ||
import toml | ||
|
||
|
||
def test_load_environment_config(monkeypatch): | ||
monkeypatch.setenv("PINNWAND_SPAMSCORE", "29") | ||
config = Configuration() | ||
config.load_environment() | ||
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 = Configuration() | ||
|
||
config.load_config_file(temp.name) | ||
assert config.database_uri == url | ||
|