Exemplo n.º 1
0
    def tearDown(self):
        """
        Restore the viewunit state to where it was before the tests
        """
        super(HookTest, self).tearDown()

        config.set_app(self._old_app)
        config.set_session_user_setter(self._old_session_hook)
        config.set_db_select_hook(self._old_db_hook)
Exemplo n.º 2
0
    def test_session_hook(self):
        config.set_app(app)

        try:
            self.run_view('/', user_id=1)
            ok_(False, "Expected AssertionError without session hook")
        except AssertionError:
            pass

        def hook(test_session, user_id):
            test_session['user_id'] = user_id
        config.set_session_user_setter(hook)

        self.run_view('/', user_id=11)