from plone import api
from plone.app.testing import TEST_USER_ID
from ploneintranet.todo.testing import IntegrationTestCase


class TestTodo(IntegrationTestCase):
    """Test Todo content type"""

    def setUp(self):
        self.portal = self.layer["portal"]

    def test_assignee_role(self):
        api.content.create(
            type="todo", title="todo1", container=self.portal, assignee=TEST_USER_ID
        )
        todo = self.portal.todo1
        self.assertIn("Assignee", api.user.get_roles(username=TEST_USER_ID, obj=todo))
