public void CreateQuery_IgnoresNullLists() { const string apiKey = "plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM-kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg"; var request = new TestRequest(); const string key = "VDaACYb0LV9eNjTetIOElcVQkvJck_J_QljX_FcHRj87ZKiy0z0ty0ZsYBkoXkY9b7eq1EhwJaw7FF3akA3KBQ"; string completeRequest = CloudStackAPIProxy.CreateQuery(request.Parameters, apiKey, key, null); completeRequest.ShouldNotContain("hosttags"); }
public void CreateQuery_WithSessionKey_CorrectlyBuildsQuery() { var arguments = new Dictionary <string, object>(); arguments.Add("response", "json"); arguments.Add("command", "listusers"); const string sessionKey = "foo"; const string expected = "command=listusers&response=json&sessionkey=" + sessionKey; string completeRequest = CloudStackAPIProxy.CreateQuery(arguments, null, null, sessionKey); completeRequest.ShouldBe(expected); }
public void CreateQuery_WithSecretKey_CorrectlyBuildsQuery() { const string apiKey = "plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM-kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg"; Dictionary <string, object> arguments = new Dictionary <string, object>(); arguments.Add("response", "json"); arguments.Add("command", "listusers"); const string key = "VDaACYb0LV9eNjTetIOElcVQkvJck_J_QljX_FcHRj87ZKiy0z0ty0ZsYBkoXkY9b7eq1EhwJaw7FF3akA3KBQ"; const string expected = "apikey=plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM-kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg&command=listusers&response=json&signature=TTpdDq%2F7j%2FJ58XCRHomKoQXEQds%3D"; string completeRequest = CloudStackAPIProxy.CreateQuery(arguments, apiKey, key, null); completeRequest.ShouldBe(expected); }
public void CreateQuery_IncludesRequestedEmptyLists() { const string apiKey = "plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM-kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg"; var arguments = new Dictionary <string, object> { { "response", "json" }, { "command", "listusers" }, { "list", new List <string>() } }; const string key = "VDaACYb0LV9eNjTetIOElcVQkvJck_J_QljX_FcHRj87ZKiy0z0ty0ZsYBkoXkY9b7eq1EhwJaw7FF3akA3KBQ"; const string expected = "apikey=plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM-kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg&command=listusers&list=&response=json&signature=jM1%2F%2FBntxGWasZKnDDDvC8AowsE%3D"; string completeRequest = CloudStackAPIProxy.CreateQuery(arguments, apiKey, key, null); completeRequest.ShouldBe(expected); }