-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug when retrieving/setting default settings values
- Loading branch information
Showing
5 changed files
with
35 additions
and
8 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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
""" | ||
A multi-user, multi-group task management and assignment system for Django. | ||
""" | ||
__version__ = "2.4.6" | ||
__version__ = "2.4.8" | ||
|
||
__author__ = "Scot Hacker" | ||
__email__ = "[email protected]" | ||
|
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 |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import pytest | ||
|
||
from django.core import mail | ||
|
||
from todo.models import Task, Comment | ||
from todo.utils import send_notify_mail, send_email_to_thread_participants | ||
from todo.defaults import defaults | ||
from todo.models import Comment, Task | ||
from todo.utils import send_email_to_thread_participants, send_notify_mail | ||
|
||
|
||
def test_send_notify_mail_not_me(todo_setup, django_user_model, email_backend_setup): | ||
|
@@ -56,5 +55,26 @@ def test_send_email_to_thread_participants(todo_setup, django_user_model, email_ | |
assert "[email protected]" in mail.outbox[0].recipients() | ||
|
||
|
||
def test_defaults(settings): | ||
"""todo's `defaults` module provides reasonable default values for unspecified settings. | ||
If a value is NOT set, it should be pulled from the hash in defaults.py. | ||
If a value IS set, it should be respected. | ||
n.b. TODO_STAFF_ONLY which defaults to True in the `defaults` module.""" | ||
|
||
key = "TODO_STAFF_ONLY" | ||
|
||
# Setting is not set, and should default to True (the value in defaults.py) | ||
assert not hasattr(settings, key) | ||
assert defaults(key) | ||
|
||
# Setting is already set to True and should be respected. | ||
settings.TODO_STAFF_ONLY = True | ||
assert defaults(key) | ||
|
||
# Setting is already set to False and should be respected. | ||
settings.TODO_STAFF_ONLY = False | ||
assert not defaults(key) | ||
|
||
|
||
# FIXME: Add tests for: | ||
# Attachments: Test whether allowed, test multiple, test extensions |