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


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

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

    def get_app(self, request=None):
        return api.content.get_view(
            "app-todo", self.portal.apps.todo, request or self.request.clone()
        )

    def test_options(self):
        app = self.get_app()
        self.assertEqual(app.browse_mode, "origin")
        app.request.__annotations__.clear()
        app.request.form["browse-mode"] = "custom"
        self.assertEqual(app.browse_mode, "custom")
