Closed npelikan closed 5 years ago
The issue is that the fixed
argument that gets passed to testthat::expect_error
et al. is hard-coded to TRUE
inside expect_mock_request
here: https://github.com/nealrichardson/httptest/blob/master/R/expect-request.R#L70
A better solution would be to have fixed = TRUE
as a default argument in L68, and then you should be able to expect_PUT(..., fixed=FALSE)
to use regular expression matching. That way, we're using the conventions/arguments that already exist in testthat
. Would you be interested in trying that?
yup, works for me!
Ok, just added full regular expression support to the expectations in that commit. Please give that a try and let me know if I missed anything.
Happy to take lead on the PR for this one, would like to start discussing some design first though.
I have a function that writes a file via a PUT request, however the design of the API requires a file name as part of the URL. As the file name is unimportant and I don't want to overwrite past files, I use a UUID for file name, ergo the urls can be something like
https://fake.com/<path>/<random_uuid>
.I'd love to test this function using something like
What would make most sense design-wise for implementing this? I was thinking a boolean argument to expect_verb, something like:
does that work for you?