Update Rust crate mockito to 0.32 - #16
Open
renovate[bot] wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.2→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
v0.13.0Compare Source
Matcher::AnyOfvariant, which takes a vector of matchers as argument.Mock::with_bodyandMock::with_body_from_filefunctions now support binary content.Viaheader) are checked over all values. The previous implementation was looking only for the first found header value.501 Not Implementedto501 Mock Not Found.422 Unprocessable Entityto422 Mock Error.Thanks to @kornelski
v0.12.0Compare Source
Mock::assert()method fails. Closes #23v0.11.1Compare Source
Matcher::JsonStringwhich works similarly to the existing Json matcher, except that it takes aStringas an argument. This can be useful for test suites which don't exposeserde_jsonmethods.Matcher::JSONtoMatcher::Jsonand introduced a deprecation warning for the old matcher.MOCKITO_DEBUGenvironment variable before running tests.v0.11.0Compare Source
--test-threads=1. Tests containing mocks will still run sequentially, but this is handled internally now. Tests that don't use mocks can be run in parallel. If you're using mocks inside doctests, please check #36v0.10.0Compare Source
serde_jsondependency to^1.0.17, which solves the JSON matcher problems when thepreserve_orderfeature ofserde_jsonis enabled.Thanks to @Diggsey
v0.9.1Compare Source
mut.Thanks to @jean553
v0.9.0Compare Source
Matcher::JSONvariant for matching JSON request bodies.Thanks to @andir
v0.8.2Compare Source
--test-threads=1flag any more.Thanks to @estin
v0.8.1Compare Source
v0.8.0Compare Source
v0.7.2Compare Source
Mock#asserterror message now prints out the last unmatched request as well:Vec, instead ofHashMapto solve the sorting problem once and for all./mockito.v0.7.1Compare Source
Mock#match_bodymethod for matching the request body by using the usualMatchervariants.v0.7.0Compare Source
Mock#assertmethod to assert that a mock was called. You can useMock#expectto specify the number of requests you're expecting. Check the docs for more details.Mock#removeorresetexplicitly. You'll want to assign your mock to a variable in order to establish its lifetime. Check the docs for examples.Mock#removemethod has been removed (or better said, it's private now). You can usestd::mem::dropif you really need to remove a mock before its lifetime ends.Mock#create_formethod has been removed. Normal Rust closures{ ... }and the lifetimes should replace this just fine.Mockstruct are now returningMockinstead of&mut Mock.v0.6.0Compare Source
Match::Regex(String), for matching the request path or headers with a regular expression.Thanks to @estin
v0.5.0Compare Source
v0.4.2Compare Source
Thanks to @alyssais
v0.4.1Compare Source
127.0.0.1(instead of0.0.0.0).Thanks to @alyssais
v0.4.0Compare Source
mockito::start()method so Mockito can be used as a standalone mock server (API documentation on that is missing though).v0.3.0Compare Source
Matcher::Anyto match only by the field name andMatcher::Missingto match the absence of a particular header. These are used within theMock::match_headercall.&strwas kept backwards compatible.Configuration
📅 Schedule: (UTC)
🚦 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.