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

        class MockModelDoesNotExist(Exception):
            pass
        self.mock_model.DoesNotExist = MockModelDoesNotExist

        def raise_does_not_exist(*args, **kwargs):
            raise self.mock_model.DoesNotExist

        self.mock_model._base_manager.get.side_effect = raise_does_not_exist

        res = self.view(req)

        self.mock_model._base_manager.get.assert_called_with(pk="3")
        self.assertEqual(res.status_code, 302)
If requested obj id does not exist, no action is taken.
dataset/ETHPy150Open mozilla/moztrap/tests/view/lists/test_actions.py/ActionsTest.test_object_does_not_exist