For some testing scenarios it can be handy to generate a binary that is able to populate it's own test database. A prerequisite for this is to bundle the fixture files with the binary. One possible way to do so is packr. But there is no straightforward way to make the bundled files available for the testfixtures package.
Luckily packr implements http.FileSystem in order to represent the bundled files in the binary. I therefore suggest to add the following functions to testfixtures:
func NewFileSystem(db *sql.DB, helper Helper, fs http.FileSystem) (*Context, error)
func LoadFixtureFileSystem(db *sql.DB, helper Helper, fs http.FileSystem) error
This would allow testfixtures to work together with packr or other sources for fixture files that implement the http.FileSystem interface.
For some testing scenarios it can be handy to generate a binary that is able to populate it's own test database. A prerequisite for this is to bundle the fixture files with the binary. One possible way to do so is
packr. But there is no straightforward way to make the bundled files available for thetestfixturespackage.Luckily
packrimplementshttp.FileSystemin order to represent the bundled files in the binary. I therefore suggest to add the following functions totestfixtures:This would allow
testfixturesto work together withpackror other sources for fixture files that implement the http.FileSystem interface.