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