Exemplo n.º 1
0
 def test_create_sailthru_list(self, mock_sailthru_client):
     """Test create list in sailthru"""
     mock_sailthru_client.api_post.return_value = SailthruResponse(JsonResponse({'ok': True}))
     self.assertEqual(_create_user_list(mock_sailthru_client, 'test_list_name'), True)
     self.assertEqual(mock_sailthru_client.api_post.call_args[0][0], "list")
     listparms = mock_sailthru_client.api_post.call_args[0][1]
     self.assertEqual(listparms['list'], 'test_list_name')
     self.assertEqual(listparms['primary'], 0)
     self.assertEqual(listparms['public_name'], 'test_list_name')
Exemplo n.º 2
0
 def test_create_sailthru_list_error(self, mock_sailthru_client):
     """Test error occurrence while creating sailthru list"""
     mock_sailthru_client.api_post.return_value = SailthruResponse(
         JsonResponse({
             'error': 43,
             'errormsg': 'Got an error'
         }))
     self.assertEqual(
         _create_user_list(mock_sailthru_client, 'test_list_name'), False)
Exemplo n.º 3
0
 def test_create_sailthru_list(self, mock_sailthru_client):
     """Test create list in sailthru"""
     mock_sailthru_client.api_post.return_value = SailthruResponse(
         JsonResponse({'ok': True}))
     assert _create_user_list(mock_sailthru_client,
                              'test_list_name') is True
     assert mock_sailthru_client.api_post.call_args[0][0] == 'list'
     listparms = mock_sailthru_client.api_post.call_args[0][1]
     assert listparms['list'] == 'test_list_name'
     assert listparms['primary'] == 0
     assert listparms['public_name'] == 'test_list_name'
Exemplo n.º 4
0
 def test_create_sailthru_list_exception(self, mock_sailthru_client):
     """Test exception raised while creating sailthru list"""
     mock_sailthru_client.api_post.side_effect = SailthruClientError
     self.assertEqual(
         _create_user_list(mock_sailthru_client, 'test_list_name'), False)