Skip to content

Commit

Permalink
tests for coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
bckohan committed Jun 5, 2024
1 parent c015552 commit 8178545
Showing 1 changed file with 34 additions and 13 deletions.
47 changes: 34 additions & 13 deletions tests/test_config.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
from io import StringIO
from importlib.util import find_spec
import pytest

from django.core.management import BaseCommand, call_command, CommandError
from django_typer import get_command
from django.test import TestCase, override_settings
from django.conf import settings
from django_routines import ROUTINE_SETTING
from django.core.exceptions import ImproperlyConfigured
import re

from tests.django_routines_tests.management.commands.track import (
invoked,
passed_options,
)
from django_routines import get_routine


class TestBadConfig(TestCase):
Expand Down Expand Up @@ -48,3 +36,36 @@ def test_malformed_routine(self):
def test_malformed_command(self):
with self.assertRaises(ImproperlyConfigured):
get_command("routine")

@override_settings(
DJANGO_ROUTINES={
"good": {
"commands": [
{"command": ("track", "0")},
{"command": ("track", "1")},
],
"help_text": "A good routine",
"name": "good",
},
}
)
def test_get_missing_routine(self):
self.assertEqual(get_routine("good").name, "good")
with self.assertRaises(KeyError):
get_routine("dne")

@override_settings(
DJANGO_ROUTINES={
"bad_command": {
"commands": [
{"command": ("track", "0")},
{"comand": ("track", "1")},
],
"help_text": "Bad command test routine",
"name": "bad_command",
},
}
)
def test_get_malformed_routine(self):
with self.assertRaises(ImproperlyConfigured):
get_routine("bad_command")

0 comments on commit 8178545

Please sign in to comment.