JCLOUDS-217: CloudStack do not encode parameters.

Parameters when creating an HTTP request should not be encoded in the
CloudStack tests, as they end up being doubly encoded.
This commit is contained in:
Timur Alperovich 2015-08-24 14:33:03 -07:00
parent 6df2233867
commit b87ca1b33a
1 changed files with 3 additions and 3 deletions

View File

@ -20,7 +20,6 @@ import static org.jclouds.reflect.Reflection2.method;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.net.URLEncoder;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
@ -34,6 +33,7 @@ import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.rest.internal.GeneratedHttpRequest;
import org.jclouds.ssh.SshKeys;
import org.jclouds.util.Strings2;
import org.testng.annotations.Test;
import com.google.common.base.Functions;
@ -99,11 +99,11 @@ public class SSHKeyPairApiTest extends BaseCloudStackApiTest<SSHKeyPairApi> {
public void testRegisterSSHKeyPair() throws SecurityException, NoSuchMethodException, IOException {
Invokable<?, ?> method = method(SSHKeyPairApi.class, "registerSSHKeyPair", String.class, String.class);
String publicKey = URLEncoder.encode(SshKeys.generate().get("public"), "UTF-8");
String publicKey = SshKeys.generate().get("public");
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("jclouds-keypair", publicKey));
assertRequestLineEquals(httpRequest,
"GET http://localhost:8080/client/api?response=json&command=registerSSHKeyPair&name=jclouds-keypair&publickey="
+ publicKey
+ Strings2.urlEncode(publicKey, '/')
+ " HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
assertPayloadEquals(httpRequest, null, null, false);