Crate mockd

source ·
Expand description

mockd

Build the request and verify

Provide mock data that conforms to the expected format as test inputs.

Providing randomly generated data is a best practice.

Examples

Using default features

use mockd::file;

    let data = file::mime_type(); // mime_type: text/x-fortran
    let data = file::extension(); // extension: aspx

Using image feature

[dependencies]
mockd = "0.4.3"
use mockd::image;

    let data = image::url(500, 500); // url: https://picsum.photos/500/500

Features

To access the related generators the feature must be enabled. The following features are available:

  • default - includes file feature only
  • all - Enables all features
  • address
  • animal
  • beer
  • company
  • contact
  • currency
  • datetime
  • file
  • generator
  • hacker
  • hipster
  • image
  • internet
  • job
  • language
  • log-level
  • name
  • password
  • payment
  • person
  • random-bool
  • status-code
  • unique
  • user-agent
  • vehicle
  • words

Modules

  • Provides 16 functions to return mock address data.
  • Provides 6 functions to return mock animal data.
  • Provides 8 functions to return mock beer data.
  • Provides a function to return a random bool.
  • Provides 4 functions to return mock colour data.
  • Provides 6 functions to return mock animal data.
  • Provides 4 functions to return mock contact data.
  • Provides 4 functions to return currency data.
  • Provides 14 functions to return mock date and time data.
  • Provides 2 functions to return mock file data.
  • Provides 1 function to generate a string based on input string.
  • Provides 6 functions to return mock hacker data.
  • Provides 3 functions to return mock hipster data.
  • Provides 1 function to return random mock image.
  • Provides 7 functions to return mock internet data.
  • Provides 4 functions to return mock job data.
  • Provides 3 functions to return mock language data.
  • Provides 3 functions to return mock log level data.
  • Provides 5 functions to return mock name data.
  • Provides 1 function to return mock password data.
  • Provides 5 functions to return mock payment data.
  • Provides 3 functions to return mock person data.
  • Provides 2 functions to return mock status code data.
  • Provides 2 functions to return mock unique data.
  • Provides 8 functions to return mock user agent data.
  • Provides 6 functions to return mock vehicle data.
  • Provides 6 functions to return mock word data.