From 3181bdfc80c1e712d84474f849408a6c5c22f20a Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Fri, 12 Nov 2021 14:37:20 -0700 Subject: [PATCH] Test ip rate limiting / throttling Tests the throttling feature from the previous commit --- test/farside_test.exs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/farside_test.exs b/test/farside_test.exs index b5561e0..a64a389 100644 --- a/test/farside_test.exs +++ b/test/farside_test.exs @@ -15,6 +15,20 @@ defmodule FarsideTest do |> Router.call(@opts) end + test "throttle" do + :get + |> conn("/", "") + |> Router.call(@opts) + + throttled_conn = + :get + |> conn("/", "") + |> Router.call(@opts) + + assert throttled_conn.state == :sent + assert throttled_conn.status == 403 + end + test "/" do conn = test_conn("/") assert conn.state == :sent