@@ -13,16 +13,88 @@ class Zencoder::ReportTest < Test::Unit::TestCase
13
13
:to => "2011-06-01" ,
14
14
:grouping => "foo" } ,
15
15
:headers => { "Zencoder-Api-Key" => @api_key } } ) . returns ( Zencoder ::Response . new )
16
- assert_equal Zencoder ::Response , Zencoder ::Report . minutes ( :api_key => @api_key , :params => { : from => "2011-01-01" ,
17
- :to => "2011-06-01" ,
18
- :grouping => "foo" } ) . class
16
+ assert_equal Zencoder ::Response , Zencoder ::Report . minutes ( :api_key => @api_key , :from => "2011-01-01" ,
17
+ :to => "2011-06-01" ,
18
+ :grouping => "foo" ) . class
19
19
end
20
20
21
21
should "merge params well" do
22
22
Zencoder ::HTTP . stubs ( :get ) . with ( @url , { :params => { :from => "2011-01-01" ,
23
23
:to => "2011-06-01" } ,
24
24
:headers => { "Zencoder-Api-Key" => @api_key } } ) . returns ( Zencoder ::Response . new )
25
- assert_equal Zencoder ::Response , Zencoder ::Report . minutes ( :api_key => @api_key , :params => { :from => "2011-01-01" , :to => "2011-06-01" } ) . class
25
+ assert_equal Zencoder ::Response , Zencoder ::Report . minutes ( :api_key => @api_key , :from => "2011-01-01" , :to => "2011-06-01" ) . class
26
+ end
27
+ end
28
+
29
+ context ".all" do
30
+ setup do
31
+ @api_key = "abcd123"
32
+ @url = "#{ Zencoder . base_url } /reports/all"
33
+ end
34
+
35
+ should "GET the correct url and return a response" do
36
+ Zencoder ::HTTP . stubs ( :get ) . with ( @url , { :params => { :from => "2011-01-01" ,
37
+ :to => "2011-06-01" ,
38
+ :grouping => "foo" } ,
39
+ :headers => { "Zencoder-Api-Key" => @api_key } } ) . returns ( Zencoder ::Response . new )
40
+ assert_equal Zencoder ::Response , Zencoder ::Report . all ( :api_key => @api_key , :from => "2011-01-01" ,
41
+ :to => "2011-06-01" ,
42
+ :grouping => "foo" ) . class
43
+ end
44
+
45
+ should "merge params well" do
46
+ Zencoder ::HTTP . stubs ( :get ) . with ( @url , { :params => { :from => "2011-01-01" ,
47
+ :to => "2011-06-01" } ,
48
+ :headers => { "Zencoder-Api-Key" => @api_key } } ) . returns ( Zencoder ::Response . new )
49
+ assert_equal Zencoder ::Response , Zencoder ::Report . all ( :api_key => @api_key , :from => "2011-01-01" , :to => "2011-06-01" ) . class
50
+ end
51
+ end
52
+
53
+ context ".vod" do
54
+ setup do
55
+ @api_key = "abcd123"
56
+ @url = "#{ Zencoder . base_url } /reports/vod"
57
+ end
58
+
59
+ should "GET the correct url and return a response" do
60
+ Zencoder ::HTTP . stubs ( :get ) . with ( @url , { :params => { :from => "2011-01-01" ,
61
+ :to => "2011-06-01" ,
62
+ :grouping => "foo" } ,
63
+ :headers => { "Zencoder-Api-Key" => @api_key } } ) . returns ( Zencoder ::Response . new )
64
+ assert_equal Zencoder ::Response , Zencoder ::Report . vod ( :api_key => @api_key , :from => "2011-01-01" ,
65
+ :to => "2011-06-01" ,
66
+ :grouping => "foo" ) . class
67
+ end
68
+
69
+ should "merge params well" do
70
+ Zencoder ::HTTP . stubs ( :get ) . with ( @url , { :params => { :from => "2011-01-01" ,
71
+ :to => "2011-06-01" } ,
72
+ :headers => { "Zencoder-Api-Key" => @api_key } } ) . returns ( Zencoder ::Response . new )
73
+ assert_equal Zencoder ::Response , Zencoder ::Report . vod ( :api_key => @api_key , :from => "2011-01-01" , :to => "2011-06-01" ) . class
74
+ end
75
+ end
76
+
77
+ context ".live" do
78
+ setup do
79
+ @api_key = "abcd123"
80
+ @url = "#{ Zencoder . base_url } /reports/live"
81
+ end
82
+
83
+ should "GET the correct url and return a response" do
84
+ Zencoder ::HTTP . stubs ( :get ) . with ( @url , { :params => { :from => "2011-01-01" ,
85
+ :to => "2011-06-01" ,
86
+ :grouping => "foo" } ,
87
+ :headers => { "Zencoder-Api-Key" => @api_key } } ) . returns ( Zencoder ::Response . new )
88
+ assert_equal Zencoder ::Response , Zencoder ::Report . live ( :api_key => @api_key , :from => "2011-01-01" ,
89
+ :to => "2011-06-01" ,
90
+ :grouping => "foo" ) . class
91
+ end
92
+
93
+ should "merge params well" do
94
+ Zencoder ::HTTP . stubs ( :get ) . with ( @url , { :params => { :from => "2011-01-01" ,
95
+ :to => "2011-06-01" } ,
96
+ :headers => { "Zencoder-Api-Key" => @api_key } } ) . returns ( Zencoder ::Response . new )
97
+ assert_equal Zencoder ::Response , Zencoder ::Report . live ( :api_key => @api_key , :from => "2011-01-01" , :to => "2011-06-01" ) . class
26
98
end
27
99
end
28
100
0 commit comments