active_encode 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/active_encode.gemspec +1 -2
- data/lib/active_encode/version.rb +1 -1
- metadata +3 -273
- data/spec/controllers/encode_record_controller_spec.rb +0 -53
- data/spec/fixtures//"file_with_double_quote/".low.mp4 +0 -0
- data/spec/fixtures//"file_with_double_quote/".mp4 +0 -0
- data/spec/fixtures/'file_with_single_quote'.low.mp4 +0 -0
- data/spec/fixtures/'file_with_single_quote'.mp4 +0 -0
- data/spec/fixtures/@/341/213/210/341/213/263/341/214/205/341/210/205 /341/210/233/341/210/255 /341/211/242. /341/210/206/341/212/225 /341/214/250/341/210/255/341/210/265. /341/210/205 /341/212/240/341/211/265/341/210/213/341/210/260!@#$^^&$%&.low.mov +0 -0
- data/spec/fixtures/@/341/213/210/341/213/263/341/214/205/341/210/205 /341/210/233/341/210/255 /341/211/242. /341/210/206/341/212/225 /341/214/250/341/210/255/341/210/265. /341/210/205 /341/212/240/341/211/265/341/210/213/341/210/260!@#$^^&$%&.mov +0 -0
- data/spec/fixtures/Bars_512kb.mp4 +0 -0
- data/spec/fixtures/elastic_transcoder/input_completed.json +0 -1
- data/spec/fixtures/elastic_transcoder/input_generic.json +0 -1
- data/spec/fixtures/elastic_transcoder/input_progressing.json +0 -1
- data/spec/fixtures/elastic_transcoder/job_canceled.json +0 -1
- data/spec/fixtures/elastic_transcoder/job_completed.json +0 -1
- data/spec/fixtures/elastic_transcoder/job_created.json +0 -1
- data/spec/fixtures/elastic_transcoder/job_failed.json +0 -1
- data/spec/fixtures/elastic_transcoder/job_progressing.json +0 -1
- data/spec/fixtures/elastic_transcoder/output_canceled.json +0 -1
- data/spec/fixtures/elastic_transcoder/output_completed.json +0 -1
- data/spec/fixtures/elastic_transcoder/output_failed.json +0 -1
- data/spec/fixtures/elastic_transcoder/output_progressing.json +0 -1
- data/spec/fixtures/elastic_transcoder/output_submitted.json +0 -1
- data/spec/fixtures/ffmpeg/cancelled-id/cancelled +0 -0
- data/spec/fixtures/ffmpeg/cancelled-id/error.log +0 -0
- data/spec/fixtures/ffmpeg/cancelled-id/exit_status.code +0 -1
- data/spec/fixtures/ffmpeg/cancelled-id/input_metadata +0 -90
- data/spec/fixtures/ffmpeg/cancelled-id/pid +0 -1
- data/spec/fixtures/ffmpeg/cancelled-id/progress +0 -11
- data/spec/fixtures/ffmpeg/completed-id/error.log +0 -0
- data/spec/fixtures/ffmpeg/completed-id/exit_status.code +0 -1
- data/spec/fixtures/ffmpeg/completed-id/input_metadata +0 -102
- data/spec/fixtures/ffmpeg/completed-id/output_metadata-high +0 -90
- data/spec/fixtures/ffmpeg/completed-id/output_metadata-low +0 -90
- data/spec/fixtures/ffmpeg/completed-id/pid +0 -1
- data/spec/fixtures/ffmpeg/completed-id/progress +0 -11
- data/spec/fixtures/ffmpeg/completed-id/video-high.mp4 +0 -0
- data/spec/fixtures/ffmpeg/completed-id/video-low.mp4 +0 -0
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/error.log +0 -3
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/exit_status.code +0 -1
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/input_metadata +0 -102
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/output_metadata-high +0 -90
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/output_metadata-low +0 -90
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/pid +0 -1
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/progress +0 -11
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/video-high.mp4 +0 -0
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/video-low.mp4 +0 -0
- data/spec/fixtures/ffmpeg/failed-id/error.log +0 -1
- data/spec/fixtures/ffmpeg/failed-id/exit_status.code +0 -1
- data/spec/fixtures/ffmpeg/failed-id/input_metadata +0 -90
- data/spec/fixtures/ffmpeg/failed-id/pid +0 -1
- data/spec/fixtures/ffmpeg/failed-id/progress +0 -11
- data/spec/fixtures/ffmpeg/incomplete-id/error.log +0 -0
- data/spec/fixtures/ffmpeg/incomplete-id/exit_status.code +0 -1
- data/spec/fixtures/ffmpeg/incomplete-id/input_metadata +0 -102
- data/spec/fixtures/ffmpeg/incomplete-id/output_metadata-high +0 -90
- data/spec/fixtures/ffmpeg/incomplete-id/output_metadata-low +0 -90
- data/spec/fixtures/ffmpeg/incomplete-id/pid +0 -1
- data/spec/fixtures/ffmpeg/incomplete-id/progress +0 -11
- data/spec/fixtures/ffmpeg/incomplete-id/video-high.mp4 +0 -0
- data/spec/fixtures/ffmpeg/incomplete-id/video-low.mp4 +0 -0
- data/spec/fixtures/ffmpeg/running-id/error.log +0 -0
- data/spec/fixtures/ffmpeg/running-id/input_metadata +0 -90
- data/spec/fixtures/ffmpeg/running-id/pid +0 -1
- data/spec/fixtures/ffmpeg/running-id/progress +0 -11
- data/spec/fixtures/file with space.low.mp4 +0 -0
- data/spec/fixtures/file with space.mp4 +0 -0
- data/spec/fixtures/file.with :=+%sp3c!l-ch4cts().mp4 +0 -0
- data/spec/fixtures/file.with...periods.mp4 +0 -0
- data/spec/fixtures/file_without_metadata.low.webm +0 -0
- data/spec/fixtures/file_without_metadata.mp4 +0 -0
- data/spec/fixtures/file_without_metadata.webm +0 -0
- data/spec/fixtures/fireworks.low.mp4 +0 -0
- data/spec/fixtures/fireworks.mp4 +0 -0
- data/spec/fixtures/matterhorn/cancelled_response.xml +0 -323
- data/spec/fixtures/matterhorn/completed_response.xml +0 -4
- data/spec/fixtures/matterhorn/create_response.xml +0 -300
- data/spec/fixtures/matterhorn/delete_track_response.xml +0 -2
- data/spec/fixtures/matterhorn/failed_response.xml +0 -4
- data/spec/fixtures/matterhorn/purged_response.xml +0 -342
- data/spec/fixtures/matterhorn/running_response.xml +0 -1
- data/spec/fixtures/matterhorn/stop_completed_response.xml +0 -228
- data/spec/fixtures/matterhorn/stop_running_response.xml +0 -339
- data/spec/fixtures/media_convert/endpoints.json +0 -1
- data/spec/fixtures/media_convert/job_canceled.json +0 -412
- data/spec/fixtures/media_convert/job_canceling.json +0 -1
- data/spec/fixtures/media_convert/job_completed.json +0 -359
- data/spec/fixtures/media_convert/job_completed_detail.json +0 -1
- data/spec/fixtures/media_convert/job_completed_detail_query.json +0 -1
- data/spec/fixtures/media_convert/job_completed_empty_detail.json +0 -1
- data/spec/fixtures/media_convert/job_created.json +0 -408
- data/spec/fixtures/media_convert/job_failed.json +0 -406
- data/spec/fixtures/media_convert/job_progressing.json +0 -414
- data/spec/fixtures/pass_through/cancelled-id/cancelled +0 -0
- data/spec/fixtures/pass_through/cancelled-id/input_metadata +0 -90
- data/spec/fixtures/pass_through/completed-id/completed +0 -0
- data/spec/fixtures/pass_through/completed-id/input_metadata +0 -102
- data/spec/fixtures/pass_through/completed-id/output_metadata-high +0 -90
- data/spec/fixtures/pass_through/completed-id/output_metadata-low +0 -90
- data/spec/fixtures/pass_through/completed-id/video-high.mp4 +0 -0
- data/spec/fixtures/pass_through/completed-id/video-low.mp4 +0 -0
- data/spec/fixtures/pass_through/failed-id/error.log +0 -1
- data/spec/fixtures/pass_through/failed-id/input_metadata +0 -90
- data/spec/fixtures/pass_through/running-id/input_metadata +0 -90
- data/spec/fixtures/zencoder/job_create.json +0 -1
- data/spec/fixtures/zencoder/job_details_cancelled.json +0 -1
- data/spec/fixtures/zencoder/job_details_completed.json +0 -1
- data/spec/fixtures/zencoder/job_details_create.json +0 -1
- data/spec/fixtures/zencoder/job_details_failed.json +0 -73
- data/spec/fixtures/zencoder/job_details_running.json +0 -1
- data/spec/fixtures/zencoder/job_progress_cancelled.json +0 -13
- data/spec/fixtures/zencoder/job_progress_completed.json +0 -13
- data/spec/fixtures/zencoder/job_progress_create.json +0 -1
- data/spec/fixtures/zencoder/job_progress_failed.json +0 -13
- data/spec/fixtures/zencoder/job_progress_running.json +0 -1
- data/spec/integration/elastic_transcoder_adapter_spec.rb +0 -218
- data/spec/integration/ffmpeg_adapter_spec.rb +0 -535
- data/spec/integration/matterhorn_adapter_spec.rb +0 -130
- data/spec/integration/media_convert_adapter_spec.rb +0 -321
- data/spec/integration/pass_through_adapter_spec.rb +0 -293
- data/spec/integration/zencoder_adapter_spec.rb +0 -391
- data/spec/rails_helper.rb +0 -25
- data/spec/routing/encode_record_controller_routing_spec.rb +0 -10
- data/spec/spec_helper.rb +0 -20
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -16
- data/spec/units/callbacks_spec.rb +0 -66
- data/spec/units/core_spec.rb +0 -160
- data/spec/units/engine_adapter_spec.rb +0 -67
- data/spec/units/file_locator_spec.rb +0 -129
- data/spec/units/filename_sanitizer_spec.rb +0 -20
- data/spec/units/global_id_spec.rb +0 -50
- data/spec/units/input_spec.rb +0 -40
- data/spec/units/output_spec.rb +0 -42
- data/spec/units/persistence_spec.rb +0 -61
- data/spec/units/polling_job_spec.rb +0 -87
- data/spec/units/polling_spec.rb +0 -23
- data/spec/units/status_spec.rb +0 -81
@@ -1,218 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'aws-sdk-elastictranscoder'
|
4
|
-
require 'json'
|
5
|
-
require 'active_encode/spec/shared_specs'
|
6
|
-
|
7
|
-
describe ActiveEncode::EngineAdapters::ElasticTranscoderAdapter do
|
8
|
-
around do |example|
|
9
|
-
# Setting this before each test works around a stubbing + memoization limitation
|
10
|
-
ActiveEncode::Base.engine_adapter = :elastic_transcoder
|
11
|
-
example.run
|
12
|
-
ActiveEncode::Base.engine_adapter = :test
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:client) { Aws::ElasticTranscoder::Client.new(stub_responses: true) }
|
16
|
-
let(:s3client) { Aws::S3::Client.new(stub_responses: true) }
|
17
|
-
|
18
|
-
before do
|
19
|
-
allow(Aws::ElasticTranscoder::Client).to receive(:new).and_return(client)
|
20
|
-
allow(Aws::S3::Client).to receive(:new).and_return(s3client)
|
21
|
-
end
|
22
|
-
|
23
|
-
let(:created_job) do
|
24
|
-
j = Aws::ElasticTranscoder::Types::Job.new JSON.parse(File.read('spec/fixtures/elastic_transcoder/job_created.json'))
|
25
|
-
j.input = Aws::ElasticTranscoder::Types::JobInput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/input_generic.json')))
|
26
|
-
j.outputs = [Aws::ElasticTranscoder::Types::JobOutput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/output_submitted.json')))]
|
27
|
-
|
28
|
-
client.stub_responses(:create_job, Aws::ElasticTranscoder::Types::ReadJobResponse.new(job: j))
|
29
|
-
|
30
|
-
ActiveEncode::Base.create(
|
31
|
-
"spec/fixtures/fireworks.mp4",
|
32
|
-
pipeline_id: "1471963629141-kmcocm",
|
33
|
-
masterfile_bucket: "BucketName",
|
34
|
-
output_key_prefix: "elastic-transcoder-samples/output/hls/",
|
35
|
-
outputs: [{
|
36
|
-
key: 'hls0400k/' + "e8fe80f5bsomefilesource_bucket7063b12d567b90c0bdf6322116bba11ac458fe9d62921644159fe4a",
|
37
|
-
preset_id: "1351620000001-200050",
|
38
|
-
segment_duration: "2"
|
39
|
-
}]
|
40
|
-
)
|
41
|
-
end
|
42
|
-
|
43
|
-
let(:running_job) do
|
44
|
-
j = Aws::ElasticTranscoder::Types::Job.new JSON.parse(File.read('spec/fixtures/elastic_transcoder/job_progressing.json'))
|
45
|
-
j.input = Aws::ElasticTranscoder::Types::JobInput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/input_progressing.json')))
|
46
|
-
j.outputs = [Aws::ElasticTranscoder::Types::JobOutput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/output_progressing.json')))]
|
47
|
-
|
48
|
-
client.stub_responses(:read_job, Aws::ElasticTranscoder::Types::ReadJobResponse.new(job: j))
|
49
|
-
ActiveEncode::Base.find('running-id')
|
50
|
-
end
|
51
|
-
|
52
|
-
let(:canceled_job) do
|
53
|
-
j = Aws::ElasticTranscoder::Types::Job.new JSON.parse(File.read('spec/fixtures/elastic_transcoder/job_canceled.json'))
|
54
|
-
j.input = Aws::ElasticTranscoder::Types::JobInput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/input_generic.json')))
|
55
|
-
j.outputs = [Aws::ElasticTranscoder::Types::JobOutput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/output_canceled.json')))]
|
56
|
-
|
57
|
-
client.stub_responses(:read_job, Aws::ElasticTranscoder::Types::ReadJobResponse.new(job: j))
|
58
|
-
|
59
|
-
ActiveEncode::Base.find('cancelled-id')
|
60
|
-
end
|
61
|
-
|
62
|
-
let(:cancelling_job) do
|
63
|
-
j1 = Aws::ElasticTranscoder::Types::Job.new JSON.parse(File.read('spec/fixtures/elastic_transcoder/job_progressing.json'))
|
64
|
-
j1.input = Aws::ElasticTranscoder::Types::JobInput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/input_progressing.json')))
|
65
|
-
j1.outputs = [Aws::ElasticTranscoder::Types::JobOutput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/output_progressing.json')))]
|
66
|
-
|
67
|
-
j2 = Aws::ElasticTranscoder::Types::Job.new JSON.parse(File.read('spec/fixtures/elastic_transcoder/job_canceled.json'))
|
68
|
-
j2.input = Aws::ElasticTranscoder::Types::JobInput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/input_generic.json')))
|
69
|
-
j2.outputs = [Aws::ElasticTranscoder::Types::JobOutput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/output_canceled.json')))]
|
70
|
-
|
71
|
-
client.stub_responses(:read_job, [Aws::ElasticTranscoder::Types::ReadJobResponse.new(job: j1), Aws::ElasticTranscoder::Types::ReadJobResponse.new(job: j2)])
|
72
|
-
|
73
|
-
cancel_response = double(Aws::ElasticTranscoder::Types::CancelJobResponse)
|
74
|
-
allow(cancel_response).to receive(:successful?).and_return(true)
|
75
|
-
allow(client).to receive(:cancel_job).and_return(cancel_response)
|
76
|
-
|
77
|
-
ActiveEncode::Base.find('cancelled-id')
|
78
|
-
end
|
79
|
-
|
80
|
-
let(:completed_job) do
|
81
|
-
j = Aws::ElasticTranscoder::Types::Job.new JSON.parse(File.read('spec/fixtures/elastic_transcoder/job_completed.json'))
|
82
|
-
j.input = Aws::ElasticTranscoder::Types::JobInput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/input_completed.json')))
|
83
|
-
j.outputs = [Aws::ElasticTranscoder::Types::JobOutput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/output_completed.json')))]
|
84
|
-
|
85
|
-
client.stub_responses(:read_job, Aws::ElasticTranscoder::Types::ReadJobResponse.new(job: j))
|
86
|
-
ActiveEncode::Base.find('completed-id')
|
87
|
-
end
|
88
|
-
|
89
|
-
let(:failed_job) do
|
90
|
-
j = Aws::ElasticTranscoder::Types::Job.new JSON.parse(File.read('spec/fixtures/elastic_transcoder/job_failed.json'))
|
91
|
-
j.input = Aws::ElasticTranscoder::Types::JobInput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/input_generic.json')))
|
92
|
-
j.outputs = [Aws::ElasticTranscoder::Types::JobOutput.new(JSON.parse(File.read('spec/fixtures/elastic_transcoder/output_failed.json')))]
|
93
|
-
|
94
|
-
client.stub_responses(:read_job, Aws::ElasticTranscoder::Types::ReadJobResponse.new(job: j))
|
95
|
-
ActiveEncode::Base.find('failed-id')
|
96
|
-
end
|
97
|
-
|
98
|
-
let(:completed_output) { [{ id: "2", url: "s3://BucketName/elastic-transcoder-samples/output/hls/hls0400k/e8fe80f5b7063b12d567b90c0bdf6322116bba11ac458fe9d62921644159fe4a", label: "hls0400k", width: 400, height: 224, frame_rate: 25, file_size: 6_901_104, duration: 117_353 }] }
|
99
|
-
let(:completed_tech_metadata) { { width: 1280, height: 720, frame_rate: 25, file_size: 21_069_678, duration: 117_312 } }
|
100
|
-
let(:failed_tech_metadata) { {} }
|
101
|
-
|
102
|
-
it_behaves_like "an ActiveEncode::EngineAdapter"
|
103
|
-
|
104
|
-
describe "#create" do
|
105
|
-
subject { created_job }
|
106
|
-
let(:create_output) { [{ id: "2", url: "s3://BucketName/elastic-transcoder-samples/output/hls/hls0400k/e8fe80f5b7063b12d567b90c0bdf6322116bba11ac458fe9d62921644159fe4a", label: "hls0400k" }] }
|
107
|
-
|
108
|
-
it { is_expected.to be_running }
|
109
|
-
it { expect(subject.current_operations).to be_empty }
|
110
|
-
|
111
|
-
it 'output has technical metadata' do
|
112
|
-
subject.output.each do |output|
|
113
|
-
expected_output = create_output.find { |expected_out| expected_out[:id] == output.id }
|
114
|
-
expect(output.as_json.symbolize_keys).to include expected_output
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
describe "#find" do
|
120
|
-
context "a running encode" do
|
121
|
-
subject { running_job }
|
122
|
-
let(:running_output) { [{ id: "2", url: "s3://BucketName/elastic-transcoder-samples/output/hls/hls0400k/e8fe80f5b7063b12d567b90c0bdf6322116bba11ac458fe9d62921644159fe4a", label: "hls0400k" }] }
|
123
|
-
let(:running_tech_metadata) { { width: 1280, height: 720, frame_rate: 25, file_size: 21_069_678, duration: 117_312 } }
|
124
|
-
|
125
|
-
it { expect(subject.current_operations).to be_empty }
|
126
|
-
|
127
|
-
it 'input has technical metadata' do
|
128
|
-
expect(subject.input.as_json.symbolize_keys).to include running_tech_metadata
|
129
|
-
end
|
130
|
-
|
131
|
-
it 'output has technical metadata' do
|
132
|
-
subject.output.each do |output|
|
133
|
-
expected_output = running_output.find { |expected_out| expected_out[:id] == output.id }
|
134
|
-
expect(output.as_json.symbolize_keys).to include expected_output
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
describe "#copy_to_input_bucket" do
|
141
|
-
context "when filename has no special characters" do
|
142
|
-
context "non-s3 file" do
|
143
|
-
let(:input_url) { "spec/fixtures/fireworks.mp4" }
|
144
|
-
let(:source_bucket) { "bucket1" }
|
145
|
-
|
146
|
-
it "calls the #upload_to_s3 method" do
|
147
|
-
allow(SecureRandom).to receive(:uuid).and_return("randomstring")
|
148
|
-
expect(described_class.new.send(:copy_to_input_bucket, input_url, source_bucket)).to eq "randomstring/fireworks.mp4"
|
149
|
-
end
|
150
|
-
end
|
151
|
-
context "s3 file" do
|
152
|
-
let(:input_url) { "s3://bucket1/file.mp4" }
|
153
|
-
let(:source_bucket) { "bucket1" }
|
154
|
-
|
155
|
-
it "calls the #check_s3_bucket method" do
|
156
|
-
expect(described_class.new.send(:copy_to_input_bucket, input_url, source_bucket)).to eq "file.mp4"
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
160
|
-
context "when filename has special characters" do
|
161
|
-
context "non-s3 file" do
|
162
|
-
let(:input) { ["'file_with_single_quote'.mp4", '"file_with_double_quote".mp4', "file with space.mp4", "file.with...periods.mp4", "file.with :=+%sp3c!l-ch4cts().mp4", '@ወዳጅህ ማር ቢ. ሆን ጨርስ. ህ አትላሰ!@#$^^&$%&.mov'] }
|
163
|
-
let(:clean) { ["_file_with_single_quote_.mp4", "_file_with_double_quote_.mp4", "file_with_space.mp4", "filewithperiods.mp4", "filewith_____sp3c_l-ch4cts__.mp4", '__________________________________.mov'] }
|
164
|
-
let(:source_bucket) { "bucket1" }
|
165
|
-
|
166
|
-
it "calls the #upload_to_s3 method" do
|
167
|
-
allow(SecureRandom).to receive(:uuid).and_return("randomstring")
|
168
|
-
input.each_with_index do |url, index|
|
169
|
-
expect(described_class.new.send(:copy_to_input_bucket, "spec/fixtures/#{url}", source_bucket)).to eq "randomstring/#{clean[index]}"
|
170
|
-
end
|
171
|
-
end
|
172
|
-
end
|
173
|
-
context "s3 file" do
|
174
|
-
let(:input_urls) { ["s3://bucket1/'file_with_single_quote'.mp4", 's3://bucket1/"file_with_double_quote".mp4', "s3://bucket1/file with space.mp4", "s3://bucket1/file.with...periods.mp4", "s3://bucket1/file.with :=+%sp3c!l-ch4cts().mp4", 's3://bucket1/@ወዳጅህ ማር ቢ. ሆን ጨርስ. ህ አትላሰ!@#$^^&$%&.mov'] }
|
175
|
-
let(:clean) { ["_file_with_single_quote_.mp4", "_file_with_double_quote_.mp4", "file_with_space.mp4", "filewithperiods.mp4", "filewith_____sp3c_l-ch4cts__.mp4", '__________________________________.mov'] }
|
176
|
-
let(:source_bucket) { "bucket2" }
|
177
|
-
|
178
|
-
it "calls the #check_s3_bucket method" do
|
179
|
-
allow(SecureRandom).to receive(:uuid).and_return("randomstring")
|
180
|
-
input_urls.each_with_index do |url, index|
|
181
|
-
expect(described_class.new.send(:copy_to_input_bucket, url, source_bucket)).to eq "randomstring/#{clean[index]}"
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
describe "#check_s3_bucket" do
|
189
|
-
context "when file exists in masterfile_bucket" do
|
190
|
-
let(:input_url) { "s3://bucket1/file.mp4" }
|
191
|
-
let(:source_bucket) { "bucket1" }
|
192
|
-
|
193
|
-
it "just returns the key" do
|
194
|
-
# TODO: move these bucket helpers out to a service class so we don't have to test private methods
|
195
|
-
expect(described_class.new.send(:check_s3_bucket, input_url, source_bucket)).to eq "file.mp4"
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
context "when file is in another bucket" do
|
200
|
-
let(:input_url) { "s3://bucket1/file.mp4" }
|
201
|
-
let(:source_bucket) { "bucket2" }
|
202
|
-
|
203
|
-
it "copies to masterfile_bucket" do
|
204
|
-
# TODO: move these bucket helpers out to a service class so we don't have to test private methods
|
205
|
-
allow(SecureRandom).to receive(:uuid).and_return("randomstring")
|
206
|
-
expect(described_class.new.send(:check_s3_bucket, input_url, source_bucket)).to eq "randomstring/file.mp4"
|
207
|
-
end
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
|
-
describe "#output_percentage" do
|
212
|
-
let(:output) { double(ActiveEncode::Output, status: "Random status") }
|
213
|
-
|
214
|
-
it "returns 0 for any other status" do
|
215
|
-
expect(described_class.new.send(:output_percentage, output)).to eq 0
|
216
|
-
end
|
217
|
-
end
|
218
|
-
end
|