Skip to content

Latest commit

 

History

History
37 lines (24 loc) · 784 Bytes

api-testing.md

File metadata and controls

37 lines (24 loc) · 784 Bytes

API Testing

  • Important, but is not easy to achieve
  • So prefer unit tests
  • Else; No need to keep to Delphi here

Approvals

import requests
import os

from approvaltests.approvals import verify_as_json

api_url = os.environ['PUBLIC_URL']

class TestForSmoke:
    def get_books(self):
        r = requests.get(f"{api_url}/books/")
        return r.json()

    def test_books(self):
        verify_as_json(self.get_books())
  • verify_as_xml possible for html/xml
  • verify for text

Restart your engines