package opium-testing

  1. Overview
  2. Docs

This module provides helpers to easily test Opium applications with Alcotest.

Testable

module Testable : sig ... end

Collection of Alcotest testables for Opium types.

handle_request

val handle_request : Opium.App.t -> Opium.Request.t -> Opium.Response.t Lwt.t

handle_request app request response processes a request request with the given Opium application app.

It processes the request the same Opium.Server_connection.run would and returns the generated response.

check_status

val check_status : ?msg:string -> Opium.Status.t -> Opium.Status.t -> unit

check_status ?msg t1 t2 checks that the status t1 and t2 are equal.

check_status'

val check_status' : ?msg:string -> expected:Opium.Status.t -> actual:Opium.Status.t -> unit

check_status' ?msg t1 t2 checks that the status t1 and t2 are equal.

This is a labeled variant of check_status

check_meth

val check_meth : ?msg:string -> Opium.Method.t -> Opium.Method.t -> unit

check_meth ?msg t1 t2 checks that the method t1 and t2 are equal.

check_meth'

val check_meth' : ?msg:string -> expected:Opium.Method.t -> actual:Opium.Method.t -> unit

check_meth' ?msg t1 t2 checks that the method t1 and t2 are equal.

This is a labeled variant of check_meth

check_version

val check_version : ?msg:string -> Opium.Version.t -> Opium.Version.t -> unit

check_version ?msg t1 t2 checks that the version t1 and t2 are equal.

check_version'

val check_version' : ?msg:string -> expected:Opium.Version.t -> actual:Opium.Version.t -> unit

check_version' ?msg t1 t2 checks that the version t1 and t2 are equal.

This is a labeled variant of check_version

check_body

val check_body : ?msg:string -> Opium.Body.t -> Opium.Body.t -> unit

check_body ?msg t1 t2 checks that the body t1 and t2 are equal.

check_body'

val check_body' : ?msg:string -> expected:Opium.Body.t -> actual:Opium.Body.t -> unit

check_body' ?msg t1 t2 checks that the body t1 and t2 are equal.

This is a labeled variant of check_body

check_request

val check_request : ?msg:string -> Opium.Request.t -> Opium.Request.t -> unit

check_request ?msg t1 t2 checks that the request t1 and t2 are equal.

check_request'

val check_request' : ?msg:string -> expected:Opium.Request.t -> actual:Opium.Request.t -> unit

check_request' ?msg t1 t2 checks that the request t1 and t2 are equal.

This is a labeled variant of check_request

check_response

val check_response : ?msg:string -> Opium.Response.t -> Opium.Response.t -> unit

check_response ?msg t1 t2 checks that the response t1 and t2 are equal.

check_response'

val check_response' : ?msg:string -> expected:Opium.Response.t -> actual:Opium.Response.t -> unit

check_response' ?msg t1 t2 checks that the response t1 and t2 are equal.

This is a labeled variant of check_response

check_cookie ?msg t1 t2 checks that the cookie t1 and t2 are equal.

check_cookie'

val check_cookie' : ?msg:string -> expected:Opium.Cookie.t -> actual:Opium.Cookie.t -> unit

check_cookie' ?msg t1 t2 checks that the cookie t1 and t2 are equal.

This is a labeled variant of check_cookie

check_body_contains

val check_body_contains : ?msg:string -> string -> Opium.Body.t -> unit Lwt.t

check_body_contains ?msg s t checks that the body t contains the string s.

OCaml

Innovation. Community. Security.