I’m putting together a JSON API which may or may not be built with
Rails. I’d like to be able to verify that the JSON API is behaving as
expected by testing it from a test client that only communicates via
HTTP.
For example, the test client will send a request to a given URL on the
test server, and then verify that the response is a JSON string equal
to what is expected by the specs. The response may also be an HTTP
response code such as a 401.
I’m currently running tests with QUnit and jQuery.ajax. It works, but
I’m wondering if there’s a better option. Has anyone else done
something like this?
Thanks!
Check out the python requests library. I’ve used it for just such a purpose and it is awesome.
http://docs.python-requests.org/en/latest/index.html