moovatom 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/spec/request_spec.rb DELETED
@@ -1,73 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe MoovAtom::MoovEngine do
4
- before do
5
- @args = {
6
- username: 'jsmith',
7
- userkey: '123',
8
- guid: '456',
9
- title: 'Test Video Title',
10
- blurb: 'A Short description about the video.',
11
- sourcefile: 'http://example.com/path/to/file/test.mp4',
12
- callbackurl: 'http://example.com/job_complete'
13
- }
14
-
15
- @moov_engine = MoovAtom::MoovEngine.new @args
16
- end
17
-
18
- after do
19
- FakeWeb.clean_registry
20
- end
21
-
22
- describe "Details request..." do
23
- it "gets the details of an existing video" do
24
- xml = File.join(File.dirname(__FILE__), 'fixtures', 'detail.xml')
25
- FakeWeb.register_uri(:post, MoovAtom::API_URL, :body => xml)
26
- xml_res = @moov_engine.details
27
- xml_res.body.must_include "<uuid>456</uuid>"
28
- xml_res.body.must_include "<versions>"
29
- end
30
- end
31
-
32
- describe "Status request success..." do
33
- it "handles a successful status request" do
34
- xml = File.join(File.dirname(__FILE__), 'fixtures', 'status_success.xml')
35
- FakeWeb.register_uri(:post, MoovAtom::API_URL, :body => xml)
36
- xml_res = @moov_engine.status
37
- xml_res.body.must_include "<uuid>456</uuid>"
38
- xml_res.body.must_include "<processing>True</processing>"
39
- xml_res.body.must_include "<error></error>"
40
- end
41
- end
42
-
43
- describe "Status request error..." do
44
- it "handles an unsuccessful status request" do
45
- xml = File.join(File.dirname(__FILE__), 'fixtures', 'status_error.xml')
46
- FakeWeb.register_uri(:post, MoovAtom::API_URL, :body => xml)
47
- xml_res = @moov_engine.status
48
- xml_res.body.must_include "<uuid>456</uuid>"
49
- xml_res.body.must_include "<processing>False</processing>"
50
- xml_res.body.must_include "<error>This was not a recognized format.</error>"
51
- end
52
- end
53
-
54
- describe "Encode request..." do
55
- it "starts encoding a new video" do
56
- xml = File.join(File.dirname(__FILE__), 'fixtures', 'encode.xml')
57
- FakeWeb.register_uri(:post, MoovAtom::API_URL, :body => xml)
58
- xml_res = @moov_engine.encode
59
- xml_res.must_equal "456"
60
- end
61
- end
62
-
63
- describe "Cancel request..." do
64
- it "cancels the encoding of an existing video" do
65
- xml = File.join(File.dirname(__FILE__), 'fixtures', 'cancel.xml')
66
- FakeWeb.register_uri(:post, MoovAtom::API_URL, :body => xml)
67
- xml_res = @moov_engine.cancel
68
- xml_res.body.must_include "<uuid>456</uuid>"
69
- xml_res.body.must_include "<message>This job was successfully cancelled.</message>"
70
- end
71
- end
72
- end
73
-