mirror of
https://github.com/TecharoHQ/anubis.git
synced 2025-09-12 06:05:29 -04:00
test(lib): you win this time spell check
Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
parent
49b5d6e04c
commit
679c87f34b
@ -743,6 +743,7 @@ func TestStripBasePrefixFromRequest(t *testing.T) {
|
|||||||
func TestChallengeFor_ErrNotFound(t *testing.T) {
|
func TestChallengeFor_ErrNotFound(t *testing.T) {
|
||||||
pol := loadPolicies(t, "testdata/aggressive_403.yaml", 0)
|
pol := loadPolicies(t, "testdata/aggressive_403.yaml", 0)
|
||||||
ckieExpiration := 10 * time.Minute
|
ckieExpiration := 10 * time.Minute
|
||||||
|
const wrongCookie = "wrong cookie"
|
||||||
|
|
||||||
srv := spawnAnubis(t, Options{
|
srv := spawnAnubis(t, Options{
|
||||||
Next: http.NewServeMux(),
|
Next: http.NewServeMux(),
|
||||||
@ -755,7 +756,7 @@ func TestChallengeFor_ErrNotFound(t *testing.T) {
|
|||||||
req := httptest.NewRequest("GET", "http://example.com/", nil)
|
req := httptest.NewRequest("GET", "http://example.com/", nil)
|
||||||
req.Header.Set("X-Real-IP", "127.0.0.1")
|
req.Header.Set("X-Real-IP", "127.0.0.1")
|
||||||
req.Header.Set("User-Agent", "CHALLENGE")
|
req.Header.Set("User-Agent", "CHALLENGE")
|
||||||
req.AddCookie(&http.Cookie{Name: anubis.TestCookieName, Value: "foogoblin"})
|
req.AddCookie(&http.Cookie{Name: anubis.TestCookieName, Value: wrongCookie})
|
||||||
|
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
srv.maybeReverseProxyOrPage(w, req)
|
srv.maybeReverseProxyOrPage(w, req)
|
||||||
@ -789,7 +790,7 @@ func TestChallengeFor_ErrNotFound(t *testing.T) {
|
|||||||
found := false
|
found := false
|
||||||
for _, cookie := range resp.Cookies() {
|
for _, cookie := range resp.Cookies() {
|
||||||
if cookie.Name == anubis.TestCookieName {
|
if cookie.Name == anubis.TestCookieName {
|
||||||
if cookie.Value == "foogoblin" {
|
if cookie.Value == wrongCookie {
|
||||||
t.Error("a new challenge cookie should be issued")
|
t.Error("a new challenge cookie should be issued")
|
||||||
}
|
}
|
||||||
found = true
|
found = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user