No fuzz ExUnit test server to mock third party services.
TestServer.HTTP- HTTP/1, HTTP/2, and WebSocket.TestServer.SSH- SSH exec, shell, and subsystems.TestServer.TCP- TCP socket endpoints.TestServer.UDP- UDP datagram endpoints.
TLS and DTLS are supported with automatically generated certificates.
Test servers are scoped to the current ExUnit test and stop automatically when the test finishes.
Request handlers are processed FIFO and consumed after a single match. Any unexpected request or unconsumed handler causes the test to fail.
TestServer intentionally does not provide open-ended expectations because they can hide retries, duplicate requests, and race conditions. When exact network requests are not relevant, consider stubbing the response at the client boundary.
Add test_server to your list of dependencies in mix.exs:
def deps do
[
{:test_server, "~> 0.1.22", only: [:test]}
]
end(The MIT License)
Copyright (c) 2022 Dan Schultzer & the Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.