test/client_test.rb in createsend-2.0.0 vs test/client_test.rb in createsend-2.1.0
- old
+ new
@@ -21,10 +21,11 @@
cl.ApiKey.should == "639d8cc27198202f5fe6037a8b17a29a59984b86d3289bc9"
cl.BasicDetails.ClientID.should == "4a397ccaaa55eb4e6aa1221e1e2d7122"
cl.BasicDetails.ContactName.should == "Client One (contact)"
cl.AccessDetails.Username.should == "clientone"
cl.AccessDetails.AccessLevel.should == 23
+ cl.BillingDetails.MonthlyScheme.should == "Basic"
end
should "get all campaigns" do
stub_get(@api_key, "clients/#{@client.client_id}/campaigns.json", "campaigns.json")
campaigns = @client.campaigns
@@ -144,15 +145,31 @@
should "set payg billing" do
stub_put(@api_key, "clients/#{@client.client_id}/setpaygbilling.json", nil)
@client.set_payg_billing "CAD", true, true, 150
end
-
- should "set monthly billing" do
+
+ should "set monthly billing (implicit)" do
stub_put(@api_key, "clients/#{@client.client_id}/setmonthlybilling.json", nil)
- @client.set_monthly_billing "CAD", true, 150
+ @client.set_monthly_billing "CAD", true, 150
+ request = FakeWeb.last_request.body
+ assert_equal("{\"Currency\":\"CAD\",\"ClientPays\":true,\"MarkupPercentage\":150,\"MonthlyScheme\":null}", request, "Request wasn't as expected")
end
+ should "set monthly billing (basic)" do
+ stub_put(@api_key, "clients/#{@client.client_id}/setmonthlybilling.json", nil)
+ @client.set_monthly_billing "CAD", true, 150, "Basic"
+ request = FakeWeb.last_request.body
+ assert_equal("{\"Currency\":\"CAD\",\"ClientPays\":true,\"MarkupPercentage\":150,\"MonthlyScheme\":\"Basic\"}", request, "Request wasn't as expected")
+ end
+
+ should "set monthly billing (unlimited)" do
+ stub_put(@api_key, "clients/#{@client.client_id}/setmonthlybilling.json", nil)
+ @client.set_monthly_billing "CAD", false, 120, "Unlimited"
+ request = FakeWeb.last_request.body
+ assert_equal("{\"Currency\":\"CAD\",\"ClientPays\":false,\"MarkupPercentage\":120,\"MonthlyScheme\":\"Unlimited\"}", request, "Request wasn't as expected")
+ end
+
should "delete a client" do
stub_delete(@api_key, "clients/#{@client.client_id}.json", nil)
@client.delete
end