Skip to content

Commit

Permalink
Fix CI error
Browse files Browse the repository at this point in the history
  • Loading branch information
aidewoode committed Jul 7, 2022
1 parent eb9997c commit 071f4fb
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CachedTranscodedStreamControllerTest < ActionDispatch::IntegrationTest

test "should set header for nginx send file" do
get new_cached_transcoded_stream_url(song_id: songs(:flac_sample).id)
assert_equal "/private_cache_media/2/Y0YxRW91S2cyUmtXMklNblpsUENIUT09_128.mp3", @response.get_header("X-Accel-Redirect")
assert_equal "/private_cache_media/2/ZmxhY19zYW1wbGVfbWQ1X2hhc2g=_128.mp3", @response.get_header("X-Accel-Redirect")
end

test "should set correct content type header" do
Expand Down
64 changes: 27 additions & 37 deletions test/fixtures/songs.yml
Original file line number Diff line number Diff line change
@@ -1,99 +1,89 @@
<% mp3_file_path = Rails.root.join('test', 'fixtures', 'files', 'artist1_album2.mp3') %>
<% flac_file_path = Rails.root.join('test', 'fixtures', 'files', 'artist1_album1.flac') %>
<% ogg_file_path = Rails.root.join('test', 'fixtures', 'files', 'artist2_album3.ogg') %>
<% wav_file_path = Rails.root.join('test', 'fixtures', 'files', 'artist2_album3.wav') %>
<% opus_file_path = Rails.root.join('test', 'fixtures', 'files', 'artist2_album3.opus') %>
<% m4a_file_path = Rails.root.join('test', 'fixtures', 'files', 'artist1_album1.m4a') %>
<% oga_file_path = Rails.root.join('test', 'fixtures', 'files', 'artist2_album3.oga') %>
<% wma_file_path = Rails.root.join('test', 'fixtures', 'files', 'artist2_album3.wma') %>
<% various_artists_file_path = Rails.root.join('test', 'fixtures', 'files', 'various_artists.mp3') %>

mp3_sample:
id: 1
name: 'mp3_sample'
file_path: <%= mp3_file_path %>
file_path_hash: <%= MediaFile.get_md5_hash(mp3_file_path) %>
md5_hash: <%= MediaFile.get_md5_hash(mp3_file_path, with_mtime: true)%>
file_path: <%= Rails.root.join('test', 'fixtures', 'files', 'artist1_album2.mp3') %>
file_path_hash: 'mp3_sample_file_path_hash'
md5_hash: 'mp3_sample_md5_hash'
artist: 'artist1'
album: 'album2'
duration: 8.0

flac_sample:
id: 2
name: 'flac_sample'
file_path: <%= flac_file_path %>
file_path_hash: <%= MediaFile.get_md5_hash(flac_file_path) %>
md5_hash: <%= MediaFile.get_md5_hash(flac_file_path, with_mtime: true) %>
file_path: <%= Rails.root.join('test', 'fixtures', 'files', 'artist1_album1.flac') %>
file_path_hash: 'flac_sample_file_path_hash'
md5_hash: 'flac_sample_md5_hash'
artist: 'artist1'
album: 'album1'
duration: 8.0

ogg_sample:
id: 3
name: 'ogg_sample'
file_path: <%= ogg_file_path %>
file_path_hash: <%= MediaFile.get_md5_hash(ogg_file_path) %>
md5_hash: <%= MediaFile.get_md5_hash(ogg_file_path, with_mtime: true) %>
file_path: <%= Rails.root.join('test', 'fixtures', 'files', 'artist2_album3.ogg') %>
file_path_hash: 'ogg_sample_file_path_hash'
md5_hash: 'ogg_sample_md5_hash'
artist: 'artist2'
album: 'album3'
duration: 8.0

wav_sample:
id: 4
name: 'wav_sample'
file_path: <%= wav_file_path %>
file_path_hash: <%= MediaFile.get_md5_hash(wav_file_path) %>
md5_hash: <%= MediaFile.get_md5_hash(wav_file_path, with_mtime: true) %>
file_path: <%= Rails.root.join('test', 'fixtures', 'files', 'artist2_album3.wav') %>
file_path_hash: 'wav_sample_file_path_hash'
md5_hash: 'wav_sample_md5_hash'
artist: 'artist2'
album: 'album3'
duration: 8.0

opus_sample:
id: 5
name: 'opus_sample'
file_path: <%= opus_file_path %>
file_path_hash: <%= MediaFile.get_md5_hash(opus_file_path) %>
md5_hash: <%= MediaFile.get_md5_hash(opus_file_path, with_mtime: true) %>
file_path: <%= Rails.root.join('test', 'fixtures', 'files', 'artist2_album3.opus') %>
file_path_hash: 'opus_sample_file_path_hash'
md5_hash: 'opus_sample_md5_hash'
artist: 'artist2'
album: 'album3'
duration: 8.0

m4a_sample:
id: 6
name: 'm4a_sample'
file_path: <%= m4a_file_path %>
file_path_hash: <%= MediaFile.get_md5_hash(m4a_file_path) %>
md5_hash: <%= MediaFile.get_md5_hash(m4a_file_path, with_mtime: true) %>
file_path: <%= Rails.root.join('test', 'fixtures', 'files', 'artist1_album1.m4a') %>
file_path_hash: 'm4a_sample_file_path_hash'
md5_hash: 'm4a_sample_md5_hash'
artist: 'artist1'
album: 'album1'
duration: 8.0

oga_sample:
id: 7
name: 'oga_sample'
file_path: <%= oga_file_path %>
file_path_hash: <%= MediaFile.get_md5_hash(oga_file_path) %>
md5_hash: <%= MediaFile.get_md5_hash(oga_file_path, with_mtime: true) %>
file_path: <%= Rails.root.join('test', 'fixtures', 'files', 'artist2_album3.oga') %>
file_path_hash: 'oga_sample_file_path_hash'
md5_hash: 'oga_sample_md5_hash'
artist: 'artist2'
album: 'album3'
duration: 8.0

wma_sample:
id: 8
name: 'wma_sample'
file_path: <%= wma_file_path %>
file_path_hash: <%= MediaFile.get_md5_hash(wma_file_path) %>
md5_hash: <%= MediaFile.get_md5_hash(wma_file_path, with_mtime: true) %>
file_path: <%= Rails.root.join('test', 'fixtures', 'files', 'artist2_album3.wma') %>
file_path_hash: 'wma_sample_file_path_hash'
md5_hash: 'wma_sample_md5_hash'
artist: 'artist2'
album: 'album3'
duration: 8.0

various_artists_sample:
id: 9
name: 'various_artists_sample'
file_path: <%= various_artists_file_path %>
file_path_hash: <%= MediaFile.get_md5_hash(various_artists_file_path) %>
md5_hash: <%= MediaFile.get_md5_hash(various_artists_file_path, with_mtime: true) %>
file_path: <%= Rails.root.join('test', 'fixtures', 'files', 'various_artists.mp3') %>
file_path_hash: 'various_artists_sample_file_path_hash'
md5_hash: 'various_artists_sample_md5_hash'
artist: 'artist1'
album: 'album4'
duration: 8.0
2 changes: 1 addition & 1 deletion test/models/stream_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class StreamTest < ActiveSupport::TestCase

test "should get transcode cache file path" do
stream = Stream.new(songs(:flac_sample))
assert_equal "#{Stream::TRANSCODE_CACHE_DIRECTORY}/2/Y0YxRW91S2cyUmtXMklNblpsUENIUT09_128.mp3", stream.transcode_cache_file_path
assert_equal "#{Stream::TRANSCODE_CACHE_DIRECTORY}/2/ZmxhY19zYW1wbGVfbWQ1X2hhc2g=_128.mp3", stream.transcode_cache_file_path
end

test "should get file duration" do
Expand Down

0 comments on commit 071f4fb

Please sign in to comment.