示例#1
0
    def _prepare(self):
        self.config = MagicMock()

        class MyView(CRUDView):
            url_path = '/test'
            Form = MagicMock()

        self.view = MyView
        self.conf = ViewConfigurator(self.config, self.view)
示例#2
0
    def _prepare(self):
        self.config = MagicMock()

        class MyView(CRUDView):
            url_path = '/test'
            Form = MagicMock()
        self.view = MyView
        self.conf = ViewConfigurator(self.config, self.view)
示例#3
0
class TestViewConfiguratorDefault(object):

    @pytest.fixture(autouse=True)
    def _prepare(self):
        self.config = MagicMock()

        class MyView(CRUDView):
            url_path = '/test'
            Form = MagicMock()
        self.view = MyView
        self.conf = ViewConfigurator(self.config, self.view)

    @pytest.mark.parametrize("action", ["list", "new", "edit"])
    def test_get_route_name(self, action):
        expected_name = 'tests.test_views.MyView.%s' % action
        assert self.conf._get_route_name(action) == expected_name

    def test_get_route_name_unique(self):
        names = set()
        for action in ["list", "new", "edit", "foo", "lol"]:
            name = self.conf._get_route_name(action)
            assert name not in names
            names.add(name)
示例#4
0
class TestViewConfiguratorDefault(object):
    @pytest.fixture(autouse=True)
    def _prepare(self):
        self.config = MagicMock()

        class MyView(CRUDView):
            url_path = '/test'
            Form = MagicMock()

        self.view = MyView
        self.conf = ViewConfigurator(self.config, self.view)

    @pytest.mark.parametrize("action", ["list", "new", "edit"])
    def test_get_route_name(self, action):
        expected_name = 'tests.test_views.MyView.%s' % action
        assert self.conf._get_route_name(action) == expected_name

    def test_get_route_name_unique(self):
        names = set()
        for action in ["list", "new", "edit", "foo", "lol"]:
            name = self.conf._get_route_name(action)
            assert name not in names
            names.add(name)