Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A Go package providing test fake filesystems
Go
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

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.

Something went wrong with that request. Please try again.