'Update IdP\'s remote_ids parameter with an empty list.'

def test_update_idp_clean_remote_ids(self):

    body = self.default_body.copy()
    body['remote_ids'] = [uuid.uuid4().hex]
    default_resp = self._create_default_idp(body=body)
    default_idp = self._fetch_attribute_from_response(default_resp, 'identity_provider')
    idp_id = default_idp.get('id')
    url = self.base_url(suffix=idp_id)
    self.assertIsNotNone(idp_id)
    body['remote_ids'] = []
    body = {'identity_provider': body}
    resp = self.patch(url, body=body)
    updated_idp = self._fetch_attribute_from_response(resp, 'identity_provider')
    body = body['identity_provider']
    self.assertEqual(sorted(body['remote_ids']), sorted(updated_idp.get('remote_ids')))
    resp = self.get(url)
    returned_idp = self._fetch_attribute_from_response(resp, 'identity_provider')
    self.assertEqual(sorted(body['remote_ids']), sorted(returned_idp.get('remote_ids')))
