test/common.rb in fastly-0.9 vs test/common.rb in fastly-0.95
- old
+ new
@@ -133,10 +133,13 @@
assert tmp
assert_equal name, tmp.name
stats = service.stats
assert stats
+
+ stats = service.stats(:all, :year => 2011, :month => 10)
+ assert stats
end
def test_invoices
name = "fastly-test-service-#{get_rand}"
service = @fastly.create_service(:name => name)
@@ -158,19 +161,28 @@
assert_equal invoices.size, services.size
assert_equal Fastly::Invoice, invoices[0].class
assert invoices[0].service_id
- invoices = @fastly.list_invoices(Time.now.year, Time.now.month)
+ year = Time.now.year
+ month = Time.now.month-1
+ month = 12 if month == 0
+
+ invoices = @fastly.list_invoices(year, month)
services = @fastly.list_services
begin
customer = @fastly.current_customer
services = services.select { |s| s.customer_id == customer.id }
rescue
end
assert_equal invoices.size, services.size
- assert_equal Fastly::Invoice, invoices[0].class
+ assert_equal Fastly::Invoice, invoices[0].class
+ assert_equal year, invoices[0].start.year
+ assert_equal month, invoices[0].start.month
+ assert_equal 1, invoices[0].start.day
+ assert_equal year, invoices[0].end.year
+ assert_equal month, invoices[0].end.month
assert invoices[0].service_id
end
end
\ No newline at end of file