test model unicode

This commit is contained in:
Ilan Steemers
2020-06-30 22:00:31 +02:00
parent b17fd24682
commit e6f82c5158
4 changed files with 13 additions and 10 deletions
+5 -5
View File
@@ -24,11 +24,11 @@ The difference is that `this` loads function calls `TimestampSigner` and `Signer
def loads( def loads(
s, s,
key=None, key=None,
salt: str = "django.core.signing", salt: str = "django.core.signing",
serializer=JSONSerializer, serializer=JSONSerializer,
max_age=None, max_age=None,
): ):
""" """
Reverse of dumps(), raise BadSignature if signature fails. Reverse of dumps(), raise BadSignature if signature fails.
+5 -5
View File
@@ -10,12 +10,12 @@ class Command(BaseCommand):
def add_arguments(self, parser): def add_arguments(self, parser):
parser.add_argument( parser.add_argument(
'--run-once', "--run-once",
action='store_true', action="store_true",
dest='run_once', dest="run_once",
default=False, default=False,
help='Run once and then stop.', help="Run once and then stop.",
) )
def handle(self, *args, **options): def handle(self, *args, **options):
monitor(run_once=options.get('run_once', False)) monitor(run_once=options.get("run_once", False))
+2
View File
@@ -142,6 +142,8 @@ def test_enqueue(broker, admin_user):
# q_options and save opt_out test # q_options and save opt_out test
k = async_task('django_q.tests.tasks.get_user_id', admin_user, k = async_task('django_q.tests.tasks.get_user_id', admin_user,
q_options={'broker': broker, 'group': 'test_k', 'save': False, 'timeout': 90}) q_options={'broker': broker, 'group': 'test_k', 'save': False, 'timeout': 90})
# test unicode
assert Task(name='Amalia').__unicode__()=='Amalia'
# check if everything has a task id # check if everything has a task id
assert isinstance(a, str) assert isinstance(a, str)
assert isinstance(b, str) assert isinstance(b, str)
+1
View File
@@ -99,6 +99,7 @@ def test_scheduler(broker, monkeypatch):
cron="0 22 * * 1-5") cron="0 22 * * 1-5")
assert hasattr(cron_schedule, 'pk') is True assert hasattr(cron_schedule, 'pk') is True
assert cron_schedule.full_clean() is None assert cron_schedule.full_clean() is None
assert cron_schedule.__unicode__() == 'django_q.tests.tasks.word_multiply'
# All other types # All other types
for t in Schedule.TYPE: for t in Schedule.TYPE:
if t[0] == Schedule.CRON: if t[0] == Schedule.CRON: