Testing Files Generator

Presets

Upload validation

Does my upload form take what it should and turn the rest away?

The upload-validation preset builds a whole set of real test files for this question in one command, and a manifest.json beside them saying how your system should react to each file. Everything below is read from the program, at the defaults of this version.

What does it usually find?

What is in the set?

At its defaults, as tfg preset show upload-validation reports it:

Files71
Targets in its recipe22
Total size120 639 488 B
Formatshtml, jpg, pdf, png, svg, txt

And what the manifest of that set expects from your system:

ExpectedMeaningFiles
acceptYour system should take the file.56
rejectYour system should turn the file away.10
unspecifiedIt depends on the rules of your system. You decide, then check that what happens is what you meant.5

What can you change?

SettingTakesDefaultWhat it does
--limit a size such as 2mb 10mb The size limit your upload form declares. This set takes one step either side of it - for a file at every distance, run the size-boundaries preset. This default is our placeholder, not your system's value. Pass your own.
--allow format ids separated by commas jpg,png,pdf Which types your form is supposed to accept. Each one becomes a real file of that type, and they are the positive control of the whole set.
--deny extensions separated by commas svg,html,exe,sh Which extensions your form is supposed to turn away. An extension this build has no format for still gets a file under that name, holding plain text.
--far-over 10x, 2x, off 2x How far past the limit the one big file goes. Turn it off where writing several times the limit is not worth the disk.
--bulk 0 - 10000 files 50 How many files the mass upload holds. Nought leaves that group out of the set altogether.

How do you run it?

See what the set would cost, build it, or take its recipe to edit:

tfg preset show upload-validation
tfg generate --preset upload-validation --limit 10mb --out ./upload-validation
tfg preset eject upload-validation > upload-validation.yaml

Or build on it in a recipe of your own, next to your tests:

version: 1
extends: preset:upload-validation
with:
  limit: 10mb