Git Product home page Git Product logo

frisby's People

Contributors

gagliardetto avatar lysu avatar snikch avatar verdverm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

frisby's Issues

Global reporting

There should be global accounting so that the user doesn't have to call PrintReport,

verbose mode would be nice and maybe print a list of accumulated errors

Can't handle period character in json field names

Hey - first up, thanks for the work on your library. We're evaluating using it and Iv'e come across an issue with the ExpectJson api.

I have a json response that looks like this:

{
  "error": "Invalid data supplied",
  "fields": {
    "display_name": "display_name is required",
    "ends_at": "ends_at is required",
    "starts_at": "starts_at is required",
    "state.state": "state must be one of the following: \"active\", \"inactive\""
  }
}

I'd love to be able to test this via ExpectJson("fields.state.state", "xxx") but for obvious reasons this isn't possible.

I see two options for fixing this. One is to change the signature of the current api, which would be a backwards incompatible change: ExpectJson(expectation string, path string...). The other option would be to add a new method with that signature, e.g. ExpectJsonAtPath(expecation string, path string...).

Thoughts?

Global request values

Should be able to set request values, such as headers, which would persist to any subsequent request

Response bodies are not closed

Golang's http library requires you to explicitly close the response's body object in order to avoid resource leaks and to allow for connection re-use.

https://golang.org/pkg/net/http/#pkg-overview

As far as I can tell Frisby doesn't do this, which can start to cause problems if you're running large numbers of tests (running out of sockets/file descriptors, slow run time, etc).

go get -u github.com/verdverm/frisby fails

go version go1.6.2 darwin/amd64

the mozilla vendored version of go-simplejson is preventing usage

sinewave:gopath robmurtha$ go get -u github.com/verdverm/frisby
# github.com/verdverm/frisby
src/github.com/verdverm/frisby/expect.go:221: cannot use json (type *"github.com/mozillazg/request/vendor/github.com/bitly/go-simplejson".Json) as type *"github.com/bitly/go-simplejson".Json in argument to foo

same issue when using gvt

ExpectJsonLength

would be a nice-to-have function, but can be accomplished with the AfterJson currently

Upgrade Testing

Testing needs to be upgraded...

  • testing directory
  • unit tests
  • functional tests
  • Ginko / Gomega ?

Specific known errors

  • ExpectJson path not a field doesn't error correctly ( #4 )

ExpectJsonType doesn't seem to work with Integer values

When trying to match a JSON returned value which is an integer, normally I (think I) should be using:
ExpectJsonType("foobar", reflect.Int), but when doing this, I get an error: Expect Json "foobar" type to be "int", but got json.Number.

Can't run expectation against array index values

I can't seem to find a way to do ExpectJson with a path like payload[0].state or payload.[0].state, and based on the code i don't think it's supported.

Do you think it would be possible to update the way that paths are looked up from simp_json.GetPath to a loop that evaluates each of the keys and checks to see if there's is an index lookup in it?

Currently we have:

path_items := strings.Split(path, ".")
simp_json = simp_json.GetPath(path_items...)

We could look at something like (exclude the psuedo code, I haven't tested this):

for _, pathItem := range strings.Split(path, ".") {
    matches := regexp.MustCompile("^\\[([0-9]+)\\]$").FindStringSubmatch(pathItem)
    if len(matches) < 2 {
        simp_json = simp_json.Get(pathItem)
    } else {
        index, _ := strconv.Atoi(matches[1])
        simp_json = simp_json.GetIndex(index)
    }
}

Update examples

  • Make Examples directory
  • Examples of PathSeparator
  • Examples of array indexing

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.