Fix broken secure media specs

This commit is contained in:
Martin Brennan 2020-02-21 10:01:32 +10:00
parent 04df3bd46d
commit 6a2bde4d48
2 changed files with 5 additions and 2 deletions

View File

@ -26,6 +26,7 @@ describe Jobs::UpdatePrivateUploadsAcl do
SiteSetting.prevent_anons_from_downloading_files = true
SiteSetting::Upload.stubs(:enable_s3_uploads).returns(true)
Discourse.stubs(:store).returns(stub(external?: false))
SiteSetting.stubs(:secure_media?).returns(true)
end
it "changes the upload to secure" do

View File

@ -1440,13 +1440,15 @@ describe Post do
it "marks attachments as secure when relevant setting is enabled" do
SiteSetting.prevent_anons_from_downloading_files = true
post = Fabricate(:post, raw: raw, user: user, topic: Fabricate(:topic, user: user))
SiteSetting.secure_media = true
private_category = Fabricate(:private_category, group: Fabricate(:group))
post = Fabricate(:post, raw: raw, user: user, topic: Fabricate(:topic, user: user, category: private_category))
post.link_post_uploads
post.update_uploads_secure_status
expect(PostUpload.where(post: post).joins(:upload).pluck(:upload_id, :secure)).to contain_exactly(
[attachment_upload.id, true],
[image_upload.id, false]
[image_upload.id, true]
)
end