Giter Site home page Giter Site logo

piquette / finance-mock Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 5.0 452 KB

finance-mock is a mock HTTP server that generates API responses similar to actual remote sources. It can be used to make test suites faster and less brittle.

License: MIT License

Makefile 0.33% Go 98.92% Shell 0.76%
golang testing finance

finance-mock's Introduction

finance-mock Build Status

finance-mock is a mock HTTP server that can be used in lieu of various remote financial data sources. The primary purpose of this server is for building test suites for piquette/finance-go that don't have to interact with the real financial data sources, making testing quicker and less prone to unpredictable upstream api errors/changes out of our control.

Usage

Get it from the Homebrew tap or download it from the releases page:

brew tap piquette/finance-mock
brew install finance-mock

# start a finance-mock service at login
brew services start finance-mock

# upgrade if you already have it
brew upgrade finance-mock

Or if you have Go installed you can build it:

go get -u github.com/piquette/finance-mock

Run it:

finance-mock

Or with docker:

# build
docker build . -t finance-mock
# run
docker run -p 12111:12111 finance-mock

Then from another terminal:

curl -i http://localhost:12111/v7/finance/quote\?symbols\=AAPL

By default, finance-mock runs on port 12111, but is configurable with the -port option.

Development

Testing

Run the test suite:

go test ./...

Binary data

The project uses [go-bindata] to bundle fixture data into bindata.go so that it's automatically included with built executables. Rebuild it with:

# Make sure you have the go-bindata executable (it's not vendored into this
# repository).
go get -u github.com/jteeuwen/go-bindata/...

# Generates `bindata.go`.
go generate

Release

Release builds are generated with goreleaser. Make sure you have the software and a GITHUB_TOKEN: set in your env.

go get -u github.com/goreleaser/goreleaser
export GITHUB_TOKEN=...

Commit changes and tag HEAD:

git tag v[NEW_VERSION_NUMBER]
git push origin --tags

Then run goreleaser and you're done! Check releases (it also pushes to the Homebrew tap).

goreleaser --rm-dist

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.