-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathzencoder_fake_test.go
66 lines (59 loc) · 1.8 KB
/
zencoder_fake_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package zencoder
import "github.com/flavioribeiro/zencoder"
type FakeZencoder struct {
}
func (z *FakeZencoder) CreateJob(settings *zencoder.EncodingSettings) (*zencoder.CreateJobResponse, error) {
return &zencoder.CreateJobResponse{
Id: 123,
}, nil
}
func (z *FakeZencoder) CancelJob(id int64) error {
return nil
}
func (z *FakeZencoder) GetJobProgress(id int64) (*zencoder.JobProgress, error) {
if id == 1234567890 {
return &zencoder.JobProgress{State: "processing", JobProgress: 10}, nil
}
return &zencoder.JobProgress{State: "finished", JobProgress: 0}, nil
}
func (z *FakeZencoder) GetJobDetails(id int64) (*zencoder.JobDetails, error) {
return &zencoder.JobDetails{
Job: &zencoder.Job{
InputMediaFile: &zencoder.MediaFile{
Url: "http://nyt.net/input.mov",
Format: "mov",
VideoCodec: "ProRes422",
Width: 1920,
Height: 1080,
DurationInMs: 50000,
},
CreatedAt: "2016-11-05T05:02:57Z",
FinishedAt: "2016-11-05T05:02:57Z",
UpdatedAt: "2016-11-05T05:02:57Z",
SubmittedAt: "2016-11-05T05:02:57Z",
OutputMediaFiles: []*zencoder.MediaFile{
{
Url: "https://mybucket.s3.amazonaws.com/destination-dir/output1.mp4",
Format: "mp4",
VideoCodec: "h264",
Width: 1920,
Height: 1080,
DurationInMs: 10000,
FileSizeInBytes: 66885256,
},
{
Url: "https://mybucket.s3.amazonaws.com/destination-dir/output2.webm",
Format: "webm",
VideoCodec: "vp8",
Width: 1080,
Height: 720,
DurationInMs: 10000,
FileSizeInBytes: 92140022,
},
},
},
}, nil
}
func (z *FakeZencoder) GetVodUsage(settings *zencoder.ReportSettings) (*zencoder.VodUsage, error) {
return &zencoder.VodUsage{}, nil
}