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.54"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§
- address
address - Provides 16 functions to return mock address data.
- animal
animal - Provides 6 functions to return mock animal data.
- beer
beer - Provides 8 functions to return mock beer data.
- bool_
rand random-bool - Provides a function to return a random bool.
- colour
colour - Provides 4 functions to return mock colour data.
- company
company - Provides 6 functions to return mock animal data.
- contact
contact - Provides 4 functions to return mock contact data.
- currency
currency - Provides 4 functions to return currency data.
- datetime
datetime - Provides 14 functions to return mock date and time data.
- file
file - Provides 2 functions to return mock file data.
- generator
generator - Provides 1 function to generate a string based on input string.
- hacker
hacker - Provides 6 functions to return mock hacker data.
- hipster
hipster - Provides 3 functions to return mock hipster data.
- image
image - Provides 1 function to return random mock image.
- internet
internet - Provides 7 functions to return mock internet data.
- job
job - Provides 4 functions to return mock job data.
- language
language - Provides 3 functions to return mock language data.
- log_
level log-level - Provides 3 functions to return mock log level data.
- name
name - Provides 5 functions to return mock name data.
- password
password - Provides 1 function to return mock password data.
- payment
payment - Provides 5 functions to return mock payment data.
- person
person - Provides 3 functions to return mock person data.
- status_
code status-code - Provides 2 functions to return mock status code data.
- unique
unique - Provides 2 functions to return mock unique data.
- user_
agent user-agent - Provides 8 functions to return mock user agent data.
- vehicle
vehicle - Provides 6 functions to return mock vehicle data.
- words
words - Provides 6 functions to return mock word data.