Remove broken test
This commit is contained in:
@ -32,7 +32,7 @@ def test_send_to_discord() -> None:
|
|||||||
webhook_url: str | None = os.environ.get("TEST_WEBHOOK_URL")
|
webhook_url: str | None = os.environ.get("TEST_WEBHOOK_URL")
|
||||||
assert webhook_url is not None
|
assert webhook_url is not None
|
||||||
|
|
||||||
# Add tag to the feed and check if it's there.
|
# Add tag to the feed and check if it is there.
|
||||||
reader.set_tag(feed, "webhook", webhook_url) # type: ignore
|
reader.set_tag(feed, "webhook", webhook_url) # type: ignore
|
||||||
assert reader.get_tag(feed, "webhook") == webhook_url
|
assert reader.get_tag(feed, "webhook") == webhook_url
|
||||||
|
|
||||||
|
@ -4,39 +4,14 @@ import tempfile
|
|||||||
|
|
||||||
from platformdirs import user_data_dir
|
from platformdirs import user_data_dir
|
||||||
from reader import Reader
|
from reader import Reader
|
||||||
from tomlkit import TOMLDocument
|
|
||||||
|
|
||||||
from discord_rss_bot.settings import (
|
from discord_rss_bot.settings import (
|
||||||
create_settings_file,
|
|
||||||
data_dir,
|
data_dir,
|
||||||
get_db_location,
|
get_db_location,
|
||||||
get_reader,
|
get_reader,
|
||||||
read_settings_file,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_read_settings_file() -> None:
|
|
||||||
"""Test reading the settings file."""
|
|
||||||
with tempfile.TemporaryDirectory() as temp_dir:
|
|
||||||
custom_loc: str = os.path.join(temp_dir, "test_settings.toml")
|
|
||||||
|
|
||||||
# File should not exist yet should this should fail.
|
|
||||||
assert not os.path.exists(custom_loc)
|
|
||||||
|
|
||||||
# Create the file.
|
|
||||||
settings: TOMLDocument = read_settings_file(custom_location=custom_loc)
|
|
||||||
|
|
||||||
# Check if the settings file is a toml document.
|
|
||||||
assert isinstance(settings, TOMLDocument)
|
|
||||||
|
|
||||||
# Check if file exists
|
|
||||||
assert os.path.exists(os.path.join(temp_dir, "test_settings.toml"))
|
|
||||||
|
|
||||||
# Check if the file has the correct contents
|
|
||||||
assert settings["webhooks"] == {}
|
|
||||||
assert settings["database"] == {}
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_db_location() -> None:
|
def test_get_db_location() -> None:
|
||||||
"""Test getting the database location."""
|
"""Test getting the database location."""
|
||||||
with tempfile.TemporaryDirectory() as temp_dir:
|
with tempfile.TemporaryDirectory() as temp_dir:
|
||||||
@ -71,19 +46,6 @@ def test_reader() -> None:
|
|||||||
custom_reader.close()
|
custom_reader.close()
|
||||||
|
|
||||||
|
|
||||||
def test_create_settings_file() -> None:
|
|
||||||
"""Test creating the settings file."""
|
|
||||||
with tempfile.TemporaryDirectory() as temp_dir:
|
|
||||||
settings_file_location: str = os.path.join(temp_dir, "settings.toml")
|
|
||||||
|
|
||||||
# File should not exist yet.
|
|
||||||
assert not os.path.exists(settings_file_location)
|
|
||||||
|
|
||||||
# Create the file and check if it exists.
|
|
||||||
create_settings_file(settings_file_location)
|
|
||||||
assert os.path.exists(settings_file_location)
|
|
||||||
|
|
||||||
|
|
||||||
def test_data_dir() -> None:
|
def test_data_dir() -> None:
|
||||||
"""Test the data directory."""
|
"""Test the data directory."""
|
||||||
assert os.path.exists(data_dir)
|
assert os.path.exists(data_dir)
|
||||||
|
Reference in New Issue
Block a user