'test async method in task that changes email in Sailthru'

@patch('email_marketing.tasks.SailthruClient.api_post')
def test_change_email(self, mock_sailthru):

    mock_sailthru.return_value = SailthruResponse(JsonResponse({'ok': True}))
    update_user_email.delay(TEST_EMAIL, 'old@edx.org')
    self.assertEquals(mock_sailthru.call_args[0][0], 'user')
    userparms = mock_sailthru.call_args[0][1]
    self.assertEquals(userparms['key'], 'email')
    self.assertEquals(userparms['id'], 'old@edx.org')
    self.assertEquals(userparms['keys']['email'], TEST_EMAIL)
