ElixirAuthMicrosoft.HTTPoisonMock (elixir_auth_microsoft v1.3.0)

A HTTPoison Mock that yields predictable results. Meant for testing.

Summary

Functions

Mocks the get/2 function from HTTPoison. It yields a predictable result similar to Microsoft's JSON result when fetching the user info. It raises an error when an invalid token is passed.

Mocks the post/3 function from HTTPoison. It yields a predictable result, with always the same access token.

Functions

@spec get(any(), nonempty_maybe_improper_list()) ::
  {:error, :bad_request} | {:ok, %{body: binary()}}

Mocks the get/2 function from HTTPoison. It yields a predictable result similar to Microsoft's JSON result when fetching the user info. It raises an error when an invalid token is passed.

Link to this function

post(url, body, headers)

@spec post(any(), any(), any()) :: {:ok, %{body: binary()}}

Mocks the post/3 function from HTTPoison. It yields a predictable result, with always the same access token.