'test non existing domain name updates Sailthru user lists with default list'

@patch('email_marketing.tasks.SailthruClient.api_post')
@patch('email_marketing.tasks.SailthruClient.api_get')
def test_add_user_list_existing_domain(self, mock_sailthru_get, mock_sailthru_post):

    update_email_marketing_config(template='')
    existing_site = Site.objects.create(domain='testing.com', name='testing.com')
    site_dict = {'id': existing_site.id, 'domain': existing_site.domain, 'name': existing_site.name}
    mock_sailthru_post.return_value = SailthruResponse(JsonResponse({'ok': True}))
    mock_sailthru_get.return_value = SailthruResponse(JsonResponse({'lists': [{'name': 'new    list'}, {'name': 'testing_com_user_list'}], 'ok': True}))
    update_user.delay({'gender': 'm', 'username': 'test', 'activated': 1}, TEST_EMAIL, site=site_dict, new_user=True)
    self.assertEquals(mock_sailthru_post.call_args[0][0], 'user')
    userparms = mock_sailthru_post.call_args[0][1]
    self.assertEquals(userparms['lists']['testing_com_user_list'], 1)
