fix(virus scan): prevent virus scans in specs
This commit is contained in:
parent
96cbbc0192
commit
9e30d5fc22
5 changed files with 40 additions and 8 deletions
|
@ -34,7 +34,9 @@ describe API::V2::GraphqlController do
|
|||
filename: file.original_filename,
|
||||
byte_size: file.size,
|
||||
checksum: compute_checksum_in_chunks(file),
|
||||
content_type: file.content_type
|
||||
content_type: file.content_type,
|
||||
# we don't want to run virus scanner on this file
|
||||
metadata: { virus_scan_result: ActiveStorage::VirusScanner::SAFE }
|
||||
}
|
||||
end
|
||||
let(:blob) do
|
||||
|
|
|
@ -11,7 +11,13 @@ FactoryBot.define do
|
|||
|
||||
trait :with_piece_justificative_file do
|
||||
after(:build) do |champ, _evaluator|
|
||||
champ.piece_justificative_file.attach(io: StringIO.new("toto"), filename: "toto.txt", content_type: "text/plain")
|
||||
champ.piece_justificative_file.attach(
|
||||
io: StringIO.new("toto"),
|
||||
filename: "toto.txt",
|
||||
content_type: "text/plain",
|
||||
# we don't want to run virus scanner on this file
|
||||
metadata: { virus_scan_result: ActiveStorage::VirusScanner::SAFE }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -143,7 +149,13 @@ FactoryBot.define do
|
|||
end
|
||||
|
||||
after(:build) do |champ, evaluator|
|
||||
champ.piece_justificative_file.attach(io: StringIO.new("x" * evaluator.size), filename: "toto.txt", content_type: "text/plain")
|
||||
champ.piece_justificative_file.attach(
|
||||
io: StringIO.new("x" * evaluator.size),
|
||||
filename: "toto.txt",
|
||||
content_type: "text/plain",
|
||||
# we don't want to run virus scanner on this file
|
||||
metadata: { virus_scan_result: ActiveStorage::VirusScanner::SAFE }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -151,7 +163,13 @@ FactoryBot.define do
|
|||
type_de_champ { association :type_de_champ_titre_identite, procedure: dossier.procedure }
|
||||
|
||||
after(:build) do |champ, _evaluator|
|
||||
champ.piece_justificative_file.attach(io: StringIO.new("toto"), filename: "toto.png", content_type: "image/png")
|
||||
champ.piece_justificative_file.attach(
|
||||
io: StringIO.new("toto"),
|
||||
filename: "toto.png",
|
||||
content_type: "image/png",
|
||||
# we don't want to run virus scanner on this file
|
||||
metadata: { virus_scan_result: ActiveStorage::VirusScanner::SAFE }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -205,7 +205,9 @@ FactoryBot.define do
|
|||
after(:create) do |dossier, _evaluator|
|
||||
dossier.justificatif_motivation.attach(
|
||||
io: StringIO.new('Hello World'),
|
||||
filename: 'hello.txt'
|
||||
filename: 'hello.txt',
|
||||
# we don't want to run virus scanner on this file
|
||||
metadata: { virus_scan_result: ActiveStorage::VirusScanner::SAFE }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -248,7 +248,9 @@ FactoryBot.define do
|
|||
after(:create) do |procedure, _evaluator|
|
||||
procedure.notice.attach(
|
||||
io: StringIO.new('Hello World'),
|
||||
filename: 'hello.txt'
|
||||
filename: 'hello.txt',
|
||||
# we don't want to run virus scanner on this file
|
||||
metadata: { virus_scan_result: ActiveStorage::VirusScanner::SAFE }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -257,7 +259,9 @@ FactoryBot.define do
|
|||
after(:create) do |procedure, _evaluator|
|
||||
procedure.deliberation.attach(
|
||||
io: StringIO.new('Hello World'),
|
||||
filename: 'hello.txt'
|
||||
filename: 'hello.txt',
|
||||
# we don't want to run virus scanner on this file
|
||||
metadata: { virus_scan_result: ActiveStorage::VirusScanner::SAFE }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -130,7 +130,13 @@ FactoryBot.define do
|
|||
type_champ { TypeDeChamp.type_champs.fetch(:piece_justificative) }
|
||||
|
||||
after(:build) do |type_de_champ, _evaluator|
|
||||
type_de_champ.piece_justificative_template.attach(io: StringIO.new("toto"), filename: "toto.txt", content_type: "text/plain")
|
||||
type_de_champ.piece_justificative_template.attach(
|
||||
io: StringIO.new("toto"),
|
||||
filename: "toto.txt",
|
||||
content_type: "text/plain",
|
||||
# we don't want to run virus scanner on this file
|
||||
metadata: { virus_scan_result: ActiveStorage::VirusScanner::SAFE }
|
||||
)
|
||||
end
|
||||
end
|
||||
factory :type_de_champ_titre_identite do
|
||||
|
|
Loading…
Add table
Reference in a new issue