Minimal test example for apiritif

PHOTO EMBED

Fri Jan 14 2022 14:34:00 GMT+0000 (Coordinated Universal Time)

Saved by @lr #api-testing #python #apiritif

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')
content_copyCOPY

Demonstrates usage of https://github.com/Blazemeter/apiritif