summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Busby <noreply+git@benbusby.com>2021-11-12 14:37:20 -0700
committerBen Busby <noreply+git@benbusby.com>2021-11-12 14:37:20 -0700
commit3181bdfc80c1e712d84474f849408a6c5c22f20a (patch)
tree44f9c2dab11035fd4027319af13ddc37fd2ea62d
parent2d988a1239bd9988d453df5baba75a610f979eb3 (diff)
downloadfarside-3181bdfc80c1e712d84474f849408a6c5c22f20a.tar.gz
Test ip rate limiting / throttling
Tests the throttling feature from the previous commit
-rw-r--r--test/farside_test.exs14
1 files changed, 14 insertions, 0 deletions
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