示例#1
0
    def test_unsubscribe_user_task_success(self, unsubscribe_mock):
        result = {
            'status': 'ok',
            'newsletters': ['foo', 'bar', 'foobar'],
            'email': '*****@*****.**',
            'token': 'token'
        }

        unsubscribe_user_task(result, newsletters=['foo', 'bar'])
        unsubscribe_mock.assert_called_with(token='token', email='*****@*****.**',
                                            newsletters=['foo', 'bar'], optout=False)
示例#2
0
    def test_unsubscribe_user_task_success(self, unsubscribe_mock):
        result = {
            'status': 'ok',
            'newsletters': ['foo', 'bar', 'foobar'],
            'email': '*****@*****.**',
            'token': 'token'
        }

        unsubscribe_user_task(result, newsletters=['foo', 'bar'])
        unsubscribe_mock.assert_called_with(token='token', email='*****@*****.**',
                                            newsletters=['foo', 'bar'], optout=False)
示例#3
0
    def test_unsubscribe_user_basket_error(self, unsubscribe_mock, retry_mock):
        result = {
            'status': 'ok',
            'newsletters': ['foo', 'bar'],
            'email': '*****@*****.**',
            'token': 'token'
        }

        exc = BasketException(u'Error error error')
        unsubscribe_mock.side_effect = [exc, None]
        retry_mock.side_effect = Retry
        with self.assertRaises(Retry):
            unsubscribe_user_task(result, newsletters=['foo', 'bar'])
        retry_mock.called_with(exc)
示例#4
0
    def test_unsubscribe_user_basket_error(self, unsubscribe_mock, retry_mock):
        result = {
            'status': 'ok',
            'newsletters': ['foo', 'bar'],
            'email': '*****@*****.**',
            'token': 'token'
        }

        exc = BasketException(u'Error error error')
        unsubscribe_mock.side_effect = [exc, None]
        retry_mock.side_effect = Retry
        with self.assertRaises(Retry):
            unsubscribe_user_task(result, newsletters=['foo', 'bar'])
        retry_mock.called_with(exc)
示例#5
0
 def test_unsubscribe_user_no_result(self):
     ok_(not unsubscribe_user_task(result={}))
示例#6
0
 def test_unsubscribe_user_no_result(self):
     ok_(not unsubscribe_user_task(result={}))