A Go package providing test fake filesystems
Go
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE.txt
README.md
fakefs.go
fakefs_test.go

README.md

fakehttpfs

fakehttpfs is a go test fake filesystem implementing the net/http Filesystem interface. It is designed to make HTTP/filesystem related tests easier to read and write.

Usage

Run go get github.com/paulhammond/fakehttpfs to install.

Create a fake filesystem using the fakehttpfs.FileSystem function:

testFS := fakehttpfs.FileSystem(
        fakehttpfs.File("/robots.txt", "User-agent: *\nDisallow: /"),
        fakehttpfs.Dir("/misc",
                fakehttpfs.File("hello.txt", "Hello")
        )
);

file, err = testFS.Open("/robots.txt")
file, err = testFS.Open("/misc/file.txt")

Full documentation is available through godoc.

License

MIT license, see LICENSE.txt for details.