coins-demo/todo/tests/conftest.py
multun c7ad961ef3 Implement mail tracker system
* Implement mail tracking

Signed-off-by: Victor "multun" Collod <victor.collod@prologin.org>

* Implement task merging

* Add a mail tracker title format pattern

* Autocomplete task names

* Fix comment display

* Track notification answers

* Add a socket timeout for the mail worker

A mail worker is a long running application. And sometimes, the IMAP server
just hangs for hours for no apparent reason. imaplib doesn't enable setting
a timeout, and setting it globally seems fine.

* Only validate the merge form when submitted

* Redirect to the new form when merging

* Prettier task edit UI

* Make task merging optional

* Test mail tracking

* Update documentation for mail tracking

* Update dependencies

* Add the TODO_COMMENT_CLASSES setting

* Fix dependencies install order

* Remove debug leftovers, improve documentation

* Fail on missing from_address
2019-03-11 00:04:19 -07:00

36 lines
1.4 KiB
Python

import pytest
from django.contrib.auth.models import Group
from todo.models import Task, TaskList
@pytest.fixture
def todo_setup(django_user_model):
# Two groups with different users, two sets of tasks.
g1 = Group.objects.create(name="Workgroup One")
u1 = django_user_model.objects.create_user(
username="u1", password="password", email="u1@example.com"
)
u1.groups.add(g1)
tlist1 = TaskList.objects.create(group=g1, name="Zip", slug="zip")
Task.objects.create(created_by=u1, title="Task 1", task_list=tlist1, priority=1)
Task.objects.create(created_by=u1, title="Task 2", task_list=tlist1, priority=2, completed=True)
Task.objects.create(created_by=u1, title="Task 3", task_list=tlist1, priority=3)
g2 = Group.objects.create(name="Workgroup Two")
u2 = django_user_model.objects.create_user(
username="u2", password="password", email="u2@example.com"
)
u2.groups.add(g2)
tlist2 = TaskList.objects.create(group=g2, name="Zap", slug="zap")
Task.objects.create(created_by=u2, title="Task 1", task_list=tlist2, priority=1)
Task.objects.create(created_by=u2, title="Task 2", task_list=tlist2, priority=2, completed=True)
Task.objects.create(created_by=u2, title="Task 3", task_list=tlist2, priority=3)
@pytest.fixture()
# Set up an in-memory mail server to receive test emails
def email_backend_setup(settings):
settings.EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"