-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connect users in tracked mail tasks #116
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4e2aea3
repair failing test, logging error in tracker.py
fross123 1a8271c
match created_by users on tracked email reciept
fross123 4cf0f9f
fix test and minor update
fross123 ac093a9
Merge branch 'master' into connect-users-tracked-mail
fross123 88c69b7
updates to mail trackingr and user connection
fross123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -58,3 +58,59 @@ def test_tracker_task_creation(todo_setup, django_user_model): | |
Comment.objects.get( | ||
task=task, body__contains="test3 content", email_message_id="<[email protected]>" | ||
) | ||
|
||
def test_tracker_email_match(todo_setup, django_user_model, settings): | ||
""" | ||
Ensure that a user is added to new lists when sent from registered email | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for adding a test! |
||
""" | ||
settings.TODO_MAIL_USER_MAPPER = True | ||
|
||
u1 = django_user_model.objects.get(username="u1") | ||
|
||
msg = make_message("test1 subject", "test1 content") | ||
msg["From"] = u1.email | ||
msg["Message-ID"] = "<[email protected]>" | ||
|
||
# test task creation | ||
task_count = Task.objects.count() | ||
consumer([msg]) | ||
|
||
assert task_count + 1 == Task.objects.count(), "task wasn't created" | ||
task = Task.objects.filter(title="[TEST] test1 subject").first() | ||
assert task is not None, "task was created with the wrong name" | ||
assert task.created_by == u1 | ||
|
||
# Check no match | ||
msg = make_message("test2 subject", "test2 content") | ||
msg["From"] = "[email protected]" | ||
msg["Message-ID"] = "<[email protected]>" | ||
|
||
# test task creation | ||
task_count = Task.objects.count() | ||
consumer([msg]) | ||
|
||
assert task_count + 1 == Task.objects.count(), "task wasn't created" | ||
task = Task.objects.filter(title="[TEST] test2 subject").first() | ||
assert task.created_by == None | ||
|
||
|
||
def test_tracker_match_users_false(todo_setup, django_user_model, settings): | ||
""" | ||
Do not match users on incoming mail if TODO_MAIL_USER_MAPPER is False | ||
""" | ||
settings.TODO_MAIL_USER_MAPPER = None | ||
|
||
u1 = django_user_model.objects.get(username="u1") | ||
|
||
msg = make_message("test1 subject", "test1 content") | ||
msg["From"] = u1.email | ||
msg["Message-ID"] = "<[email protected]>" | ||
|
||
# test task creation | ||
task_count = Task.objects.count() | ||
consumer([msg]) | ||
|
||
assert task_count + 1 == Task.objects.count(), "task wasn't created" | ||
task = Task.objects.filter(title="[TEST] test1 subject").first() | ||
assert task is not None, "task was created with the wrong name" | ||
assert task.created_by == None |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.