Update Rust crate mockito to 0.32 #9
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.13→0.32Release Notes
lipanski/mockito (mockito)
v0.32.5Compare Source
Arc(more reliable in this case)v0.32.4Compare Source
Mock::with_body_from_requestwhich allows setting the response body dynamically, based on theRequestobjectMutexwith anRwLockv0.32.3Compare Source
Server::newandServer::new_asyncnow return aServerGuardobject which dereferences toServer- this is only relevant if you need to assign a type to your serverv0.32.2Compare Source
_asyncmethodsv0.32.1Compare Source
v0.32.0Compare 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::ServerAPI: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
_asyncmethods:Server::new_asyncMock::create_asyncMock::assert_asyncMock::matched_asyncServer::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:
v0.31.1Compare Source
Thanks to @chantra
v0.31.0Compare Source
Thanks to @ameliabradley
v0.30.0Compare Source
assert-json-diffdependency.Thanks to @davidpdrsn
v0.29.0Compare Source
rand,colored,serde_urlencoded,env_loggerThanks to @kornelski and @davidpdrsn
v0.28.0Compare Source
Matcher::Binaryvariant for matching binary content.Thanks to @torrefatto
v0.27.0Compare Source
Mock#matched()as a soft way of checking that a Mock, as opposed to theMock#assert()method, which panics.Thanks @max-b
v0.26.0Compare Source
v0.25.3Compare Source
+wouldn't be interpreted properly byMatcher::UrlEncoded.Thanks to @cakekindel
v0.25.2Compare Source
AllOfandAnyOfparts.Thanks to @max-b
v0.25.1Compare Source
96f3e30v0.25.0Compare Source
b0966f8501 Mock Not Implementedresponse now comes with acontent-length: 0header, to prevent some clients from hanging.Thanks to @xneomac
v0.23.3Compare Source
assert-json-difflibrary (version 1.0.3)v0.23.2Compare Source
assert-json-difflibrary.Thanks to @vldm
v0.23.1Compare Source
connection: closeheader on all responses delivered by Mockito as this is the default behaviour at the moment.v0.23.0Compare Source
Mock#expect_at_leastandMock#expect_at_mostfunctions to be used together withMock#assert.cargo fmtformatting as part of CI.Thanks to @kornelski @xneomac @thomasetter
v0.22.0Compare Source
AnyOfmatcher for the path/query parts within amockcall.Thanks to @thomasetter
v0.21.0Compare Source
color(enabled by default), that controls whether the output is coloured and, more importantly, whether thecoloredcrate is required.Thanks to @repi
v0.20.0Compare Source
Matcher::PartialJsonandMatcher::PartialJsonStringvariants to match a JSON String partially (inclusion).Thanks to @matteosister
v0.19.0Compare Source
Mock#with_body_from_fnfunction, which allows generating the response body programmatically.Thanks to @kornelski
v0.18.0Compare Source
Matcher::AllOf, which can be used to check a set of matchers in conjunction. It works in a similar way to the existingMatcher::AnyOf.Matcher::UrlEncodedto match key/value pairs in URL-encoded strings.Mock#match_queryto be able to match the URL query part distinctly from the path. The function supports all known matchers but works best withMatcher::UrlEncoded. The old behaviour of matching the query as part of the path argument in amockcall has been preserved, but usingMock#match_queryhas the effect of overriding that.🎈 🎈 🎈
v0.17.1Compare Source
Thanks to @ignatenkobrain
v0.17.0Compare Source
Transfer-Encoding: chunked.Thanks to @loyd
v0.16.0Compare Source
Content-Length.Content-Lengthresponse header and skipping the response body entirely in the particular case ofHEADrequests.Thanks to @loyd
v0.15.1Compare Source
Thanks to @saks
v0.15.0Compare Source
mockito::SERVER_URLormockito::SERVER_ADDRESStomockito::server_url()ormockito::server_address().Thanks to @kornelski
v0.14.1Compare Source
v0.14.0Compare Source
~~This is the release candidate for the 1.0.0 🎉 ~~
Matcher::JSON, in favour ofMatcher::Json.Thanks to @sterlingjensen, @otavio, @galaxie and @mikrostew
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 becomes conflicted, 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.