def test_action_called(self):
        req = self.req("post", "/the/url", data={"action-doit": "3"})
        req.user = Mock()

        self.view(req)

        model_get = self.mock_model._base_manager.get
        model_get.assert_called_with(pk="3")

        instance = model_get.return_value
        instance.doit.assert_called_with(user=req.user)
Correct method is called on correct object, with user.
dataset/ETHPy150Open mozilla/moztrap/tests/view/lists/test_actions.py/ActionsTest.test_action_called