Пример #1
0
 def test_get_sailthru_list_map_no_list(self, mock_sailthru_client):
     """Test when no list returned from sailthru"""
     mock_sailthru_client.api_get.return_value = SailthruResponse(
         JsonResponse({'lists': []}))
     self.assertEqual(
         _get_list_from_email_marketing_provider(mock_sailthru_client), {})
     mock_sailthru_client.api_get.assert_called_with("list", {})
Пример #2
0
 def test_get_sailthru_list_map_error(self, mock_sailthru_client):
     """Test when error occurred while fetching data from sailthru"""
     mock_sailthru_client.api_get.return_value = SailthruResponse(
         JsonResponse({
             'error': 43,
             'errormsg': 'Got an error'
         }))
     self.assertEqual(
         _get_list_from_email_marketing_provider(mock_sailthru_client), {})
Пример #3
0
 def test_get_sailthru_list(self, mock_sailthru_client):
     """Test fetch list data from sailthru"""
     mock_sailthru_client.api_get.return_value = \
         SailthruResponse(JsonResponse({'lists': [{'name': 'test1_user_list'}]}))
     self.assertEqual(
         _get_list_from_email_marketing_provider(mock_sailthru_client),
         {'test1_user_list': {'name': 'test1_user_list'}}
     )
     mock_sailthru_client.api_get.assert_called_with("list", {})
Пример #4
0
 def test_get_sailthru_list(self, mock_sailthru_client):
     """Test fetch list data from sailthru"""
     mock_sailthru_client.api_get.return_value = SailthruResponse(
         JsonResponse({"lists": [{"name": "test1_user_list"}]})
     )
     self.assertEqual(
         _get_list_from_email_marketing_provider(mock_sailthru_client),
         {"test1_user_list": {"name": "test1_user_list"}},
     )
     mock_sailthru_client.api_get.assert_called_with("list", {})
Пример #5
0
 def test_get_sailthru_list_map_exception(self, mock_sailthru_client):
     """Test when exception raised while fetching data from sailthru"""
     mock_sailthru_client.api_get.side_effect = SailthruClientError
     self.assertEqual(
         _get_list_from_email_marketing_provider(mock_sailthru_client), {})
Пример #6
0
 def test_get_sailthru_list_map_exception(self, mock_sailthru_client):
     """Test when exception raised while fetching data from sailthru"""
     mock_sailthru_client.api_get.side_effect = SailthruClientError
     self.assertEqual(_get_list_from_email_marketing_provider(mock_sailthru_client), {})
Пример #7
0
 def test_get_sailthru_list_map_error(self, mock_sailthru_client):
     """Test when error occurred while fetching data from sailthru"""
     mock_sailthru_client.api_get.return_value = SailthruResponse(
         JsonResponse({'error': 43, 'errormsg': 'Got an error'})
     )
     self.assertEqual(_get_list_from_email_marketing_provider(mock_sailthru_client), {})
Пример #8
0
 def test_get_sailthru_list_map_no_list(self, mock_sailthru_client):
     """Test when no list returned from sailthru"""
     mock_sailthru_client.api_get.return_value = SailthruResponse(JsonResponse({'lists': []}))
     self.assertEqual(_get_list_from_email_marketing_provider(mock_sailthru_client), {})
     mock_sailthru_client.api_get.assert_called_with("list", {})