chore(deps): update rust crate mockito to v1 (1.x) #12272
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
0.31
->1.0
Release Notes
lipanski/mockito (mockito)
v1.6.1
Compare Source
Mock::with_header_from_request
allowing you to set the header dynamically by using a closure which exposes theRequest
objectThanks to @alex-kattathra-johnson
v1.6.0
Compare Source
Mock::match_request
which exposes theRequest
object via a closure and can be used to build custom matchersv1.5.0
Compare Source
Thanks to @tottoto
v1.4.0
Compare Source
colored
cratev1.3.1
Compare Source
Semaphore::const_new
wasn't available on Tokio < 1.30 because of the missing Tokioparking_lot
feature flagfutures
crate (aside fromfutures-core
)Thanks to @tottoto
v1.3.0
Compare Source
Server::new_with_opts
,Server::new_with_opts_async
and theServerOpts
struct to allow configuring the server host, port and enabling auto-asserts (see next item)assert_on_drop
server option that allows you to automatically callassert()
whenever your mocks go out of scope (defaults to false)Server::socket_address()
to return the raw serverSocketAddr
hyper::header::HeaderValue
as amatch_header()
valueThanks to @andrewtoth @alexander-jackson
v1.2.0
Compare Source
mac_os
targets to prevent hitting the file descriptor limitThanks to @kornelski
v1.1.1
Compare Source
with_chunked_body
supports streaming responses (as opposed to writing the entire buffer in one go)Thanks to @kornelski
v1.1.0
Compare Source
v1.0.2
Compare Source
v1.0.1
Compare Source
futures::future::join_all
would block the server pool.Server::reset_async
has been deprecated in favour ofServer::reset
since the former doesn't have an async implementation any more.v1.0.0
Compare Source
🎈 7 years and 63 releases later, it's finally time for the 1.0 🎈
Changes
Mock::with_body_from_fn
was renamed toMock::with_chunked_body
- the former is still supported with a deprecation warningMock::remove
andMock::remove_async
methods to remove mocks on demandMajor changes since 0.31
For a list of all the changes please check the release log.
Migrating to the new API
Legacy API:
New API:
Migrating to the async API
In order to write async tests, you'll need to use the
_async
methods:Server::new_async
Mock::create_async
Mock::assert_async
Mock::matched_async
Mock::remove_async
Server::reset_async
...otherwise your tests will not compile and you'll see this error:
Example:
v0.32.5
Compare Source
Arc
(more reliable in this case)v0.32.4
Compare Source
Mock::with_body_from_request
which allows setting the response body dynamically, based on theRequest
objectMutex
with anRwLock
v0.32.3
Compare Source
Server::new
andServer::new_async
now return aServerGuard
object which dereferences toServer
- this is only relevant if you need to assign a type to your serverv0.32.2
Compare Source
_async
methodsv0.32.1
Compare Source
v0.32.0
Compare Source
This is a major re-write, introducing a bunch of long awaited features:
[Breaking] The minimum supported Rust version was bumped to 1.65.0
Tests can now run in parallel as long as you use the new
mockito::Server
API:You can run multiple servers/hosts at the same time:
Support for HTTP2
An async interface for all actions (though the sync interface is also available):
The backend has been rewritten to use Hyper
This version will be backwards compatible with the previous version, but deprecation warnings have been introduced and you are encouraged to migrate, since the old API still requires running tests sequentially. Migrating to the new API is quite straighforward:
Migrating to the new API
Legacy API:
New API:
Migrating to the async API
In order to write async tests, you'll need to use the
_async
methods:Server::new_async
Mock::create_async
Mock::assert_async
Mock::matched_async
Server::reset_async
...otherwise your tests will not compile and you'll see this error:
Cannot start a runtime from within a runtime
.When using tokio, prefer the single-threaded runtime over the multi-threaded one.
Example:
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.