示例#1
0
class AddAndRemoveUserTestCase(TestCase):
    @class_setup
    def init_api_object(self):
        from time import time
        self.api = API(url, username, password, sessionid)
        self.email = '*****@*****.**' % time()

        # Create the user
        self.created = self.api.add_user(list_id, self.email,
                                         {'Currency': 'USD'})
        self.retrieved_currency = \
            self.api.get_user_info(list_id, self.email)['COLUMNS']['Currency']

        # Remove the user
        self.removed = self.api.remove_user(list_id, self.email)

    def test_user_created(self):
        assert_equal(self.created, True)

    def test_retrieval_of_new_user_succeeded(self):
        assert_in('USD', self.retrieved_currency)

    def test_user_removed(self):
        assert_equal(self.removed, True)

    def test_retrieval_of_removed_user_fails(self):
        assert_raises(ResponseException, self.api.get_user_info, list_id,
                      self.email)
示例#2
0
class AddAndRemoveUserTestCase(TestCase):
    @class_setup
    def init_api_object(self):
        from time import time
        self.api = API(url, username, password, sessionid)
        self.email = '*****@*****.**' % time()
        
        # Create the user
        self.created = self.api.add_user(list_id, self.email,
                                                  {'Currency': 'USD'})
        self.retrieved_currency = \
            self.api.get_user_info(list_id, self.email)['COLUMNS']['Currency']
    
        # Remove the user
        self.removed = self.api.remove_user(list_id, self.email)
    
    def test_user_created(self):
        assert_equal(self.created, True)
    
    def test_retrieval_of_new_user_succeeded(self):
        assert_in('USD', self.retrieved_currency)
    
    def test_user_removed(self):
        assert_equal(self.removed, True)
    
    def test_retrieval_of_removed_user_fails(self):
        assert_raises(ResponseException,
                                  self.api.get_user_info, list_id, self.email)
示例#3
0
class OptOutTestCase(TestCase):
    @class_setup
    def init_api_object(self):
        self.api = API(url, username, password, sessionid)
        self.api.add_user(list_id, '*****@*****.**')

        self.opt_out = self.api.opt_out_user(list_id, '*****@*****.**')

        self.user_data = self.api.get_user_info(list_id, '*****@*****.**')

        self.api.remove_user(list_id, '*****@*****.**')

    def test_opt_out_call_success(self):
        assert_equal(self.opt_out, True)

    def test_silverpop_says_opted_out(self):
        assert_not_equal(self.user_data['OptedOut'], '')
示例#4
0
class OptOutTestCase(TestCase):
    @class_setup
    def init_api_object(self):
        self.api = API(url, username, password, sessionid)
        self.api.add_user(list_id, '*****@*****.**')
        
        self.opt_out = self.api.opt_out_user(list_id, '*****@*****.**')
        
        self.user_data = self.api.get_user_info(list_id, '*****@*****.**')
        
        self.api.remove_user(list_id, '*****@*****.**')
    
    def test_opt_out_call_success(self):
        assert_equal(self.opt_out, True)
    
    def test_silverpop_says_opted_out(self):
        assert_not_equal(self.user_data['OptedOut'], '')