I plan on porting a Java based API test suite to javascript and am looking for framework suggestions. I've been looking at using Frisby or Chakram. Any advice on choosing a framework?Thanks
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.
Visit this group at https://groups.google.com/group/api-craft.
For more options, visit https://groups.google.com/d/optout.
class ExpectResponseWrapper
constructor: (req) ->
@req = req
@expectations = []
add: (exp) ->
@expectations.push exp
this
success: -> @add (res) ->
expect(res.status, 'HTTP status code is 2xx (Success)').to.be.within(200,299)
status: (code) -> @add (res) ->
expect(res.status, "HTTP status code is #{code}").to.equal(code)
json: -> @add (res) ->
expect(res.type, "Content type is application/json").to.equal('application/json')
andDo: (fn) -> @add fn
end: (done) ->
@req.end (err, res) =>
if err
if done? then done err else throw err
return
try
exp res for exp in @expectations
catch e
if done? then done e else throw e
return
done?()
expectResponse = (req) -> new ExpectResponseWrapper(req)
it "can be created", (done) =>
req = request.post @url
.set 'Content-Type', 'application/json'
.send @body
expectResponse(req)
.status(201)
.andDo (res) =>
@obj = res.body
@loc = res.headers['location']
.end(done)
I'm trying to test an api call that does a multipart upload using a json object instead of a file. Here is an example of the json that gets passed in a parameter named jsonpayload:
{ "videos": [{ "remote_url": "https://s3.amazonaws.com/testing/test_videos/video.mp4" }], "text": "groups", "author": { "alias": "testing", "token": "1456167795" }, "groups": ["custom"] ,"tags":["tagged"]}
--
You received this message because you are subscribed to a topic in the Google Groups "API Craft" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/api-craft/xoXufIVFPtY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to api-craft+...@googlegroups.com.