示例#1
0
 def test_get_success_url(self):
     """
     Test :py:meth:`.DeletionMixin.get_success_url`.
     """
     mixin = DeletionMixin()
     mixin.success_url = 'success-url'
     self.assertEqual('success-url', mixin.get_success_url())
示例#2
0
    def test_delete(self, redirect):
        """
        Test :py:meth:`.DeletionMixin.delete`.
        """
        mixin = DeletionMixin()
        mixin.object = Mock()
        mixin.get_success_url = Mock(return_value='success-url')

        self.assertEqual(redirect.return_value, mixin.delete())
        mixin.object.delete.assert_called_once_with()
        redirect.assert_called_once_with('success-url')