mirror of
https://github.com/edgurgel/httparrot
synced 2025-04-05 08:12:31 -04:00
27 lines
708 B
Elixir
27 lines
708 B
Elixir
defmodule HTTParrot.DeleteCookiesHandlerTest do
|
|
use ExUnit.Case
|
|
import :meck
|
|
import HTTParrot.DeleteCookiesHandler
|
|
|
|
setup do
|
|
new(:cowboy_req)
|
|
on_exit(fn -> unload() end)
|
|
:ok
|
|
end
|
|
|
|
test "delete cookies and redirect to /cookies " do
|
|
expect(:cowboy_req, :set_resp_cookie, [
|
|
{["k1", "v1", :req1, %{path: "/", max_age: 0}], :req2},
|
|
{["k2", "v2", :req2, %{path: "/", max_age: 0}], :req3}
|
|
])
|
|
|
|
expect(:cowboy_req, :reply, [
|
|
{[302, %{"location" => "/cookies"}, "Redirecting...", :req3], :req4}
|
|
])
|
|
|
|
assert get_json(:req1, [{"k1", "v1"}, {"k2", "v2"}]) ==
|
|
{:halt, :req4, [{"k1", "v1"}, {"k2", "v2"}]}
|
|
|
|
assert validate(:cowboy_req)
|
|
end
|
|
end
|