Skip to content
Draft
Changes from all commits
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
9 changes: 9 additions & 0 deletions geotrek/common/tests/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,21 @@ def test_bad_parser_class(self):
verbosity=0,
)

@override_settings(VAR_DIR=os.path.join(os.path.dirname(__file__), "data"))
def test_bad_parser_file(self):
with self.assertRaisesRegex(
CommandError, "Failed to import parser class 'DoesNotExist'"
):
call_command("import", "DoesNotExist", "", verbosity=0)

@override_settings(VAR_DIR=os.path.join(os.path.dirname(__file__), "missing"))
def test_missing_custom_parser_file(self):
with self.assertRaisesRegex(
CommandError,
f"Failed to import parser file '{os.path.join(os.path.dirname(__file__), 'missing', 'conf/parsers.py')}'",
):
call_command("import", "DoesNotExist", "", verbosity=0)

def test_no_filename_no_url(self):
with self.assertRaisesRegex(CommandError, "File path missing"):
call_command(
Expand Down
Loading