Dan Jacob on Nostr: #rust people: what is best practice (with libraries or whatever) for mocking in ...
#rust people: what is best practice (with libraries or whatever) for mocking in tests?
Case in point: I want to test handling different responses from an HTTP request, using local files to provide mocked XML/RSS documents. I currently use reqwest. Would be good to be able to test e.g. a 404 or 500 response or different XML payloads.
Published at
2024-01-26 07:24:01Event JSON
{
"id": "450ed0dee1d54ba6b64faf62965212e978d6a9e8db0242f673909a406a804f0d",
"pubkey": "de044c5cc023df4c71fce0eb20d65210e5f6ccd402950cbc4f2cb73f40f6bbc2",
"created_at": 1706253841,
"kind": 1,
"tags": [
[
"t",
"rust"
],
[
"proxy",
"https://masto.ai/users/danjac/statuses/111821051724456557",
"activitypub"
]
],
"content": "#rust people: what is best practice (with libraries or whatever) for mocking in tests?\n\nCase in point: I want to test handling different responses from an HTTP request, using local files to provide mocked XML/RSS documents. I currently use reqwest. Would be good to be able to test e.g. a 404 or 500 response or different XML payloads.",
"sig": "bf38f75e959baee5aa6309ee25108064d620a7ac3f9b28c70889a0bd1aa20f45e91e2f15df52632c9a9c9453482b97e55b2e6d1d88c3edc08d0f4aecca414bac"
}