Snippets Collections
import apiritif
from apiritif import http

def testRandomDogImage():
    with apiritif.transaction('Random'):
        response = http.get("https://dog.ceo/api/breeds/image/random")
        response.assert_ok()
        response.assert_header_value('Content-Type', 'application/json')
        response.assert_has_header('X-Cache')
        response.assert_in_body('"success"')
        response.assert_jsonpath('status', 'success')
const request = require('supertest');
const assert = require('assert');

request('https://dog.ceo')
  .get('/api/breeds/image/random')
  .expect(200) // assert HTTP status code
  .expect('Content-Type', 'application/json') // assert content type
  .expect(function(res) { // assert body JSON structure
    assert(res.body.hasOwnProperty('status'));
    assert(res.body.hasOwnProperty('message'));
  })
  .end(function(err, res) {
    if (err) throw err;
  });

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension