jane remover
Some checks failed
Docker image builds / build (push) Waiting to run
Asset Build Verification / asset_verification (push) Has been cancelled
Docs deploy / build (push) Has been cancelled
Go Mod Tidy Check / go_mod_tidy_check (push) Has been cancelled
Go / go_tests (push) Has been cancelled
Package builds (unstable) / package_builds (push) Has been cancelled
Smoke tests / smoke-test (default-config-macro) (push) Has been cancelled
Smoke tests / smoke-test (docker-registry) (push) Has been cancelled
Smoke tests / smoke-test (double_slash) (push) Has been cancelled
Smoke tests / smoke-test (forced-language) (push) Has been cancelled
Smoke tests / smoke-test (git-clone) (push) Has been cancelled
Smoke tests / smoke-test (git-push) (push) Has been cancelled
Smoke tests / smoke-test (healthcheck) (push) Has been cancelled
Smoke tests / smoke-test (i18n) (push) Has been cancelled
Smoke tests / smoke-test (log-file) (push) Has been cancelled
Smoke tests / smoke-test (nginx) (push) Has been cancelled
Smoke tests / smoke-test (palemoon/amd64) (push) Has been cancelled
Smoke tests / smoke-test (robots_txt) (push) Has been cancelled
Check Spelling / Check Spelling (push) Has been cancelled
SSH CI / ssh (aarch64-16k) (push) Has been cancelled
SSH CI / ssh (aarch64-4k) (push) Has been cancelled
SSH CI / ssh (ppc64le) (push) Has been cancelled
SSH CI / ssh (riscv64) (push) Has been cancelled
zizmor / zizmor latest via PyPI (push) Has been cancelled

This commit is contained in:
Soph :3 2026-02-07 13:08:47 +02:00
parent d2205b11a7
commit 896858e027
332 changed files with 1482 additions and 33742 deletions

View file

@ -6,8 +6,8 @@ import (
"net/url"
"testing"
"github.com/TecharoHQ/anubis"
"github.com/TecharoHQ/anubis/lib/policy"
"git.sad.ovh/sophie/nuke"
"git.sad.ovh/sophie/nuke/lib/policy"
)
func TestSetCookie(t *testing.T) {
@ -21,23 +21,23 @@ func TestSetCookie(t *testing.T) {
name: "basic",
options: Options{},
host: "",
cookieName: anubis.CookieName,
cookieName: nuke.CookieName,
},
{
name: "domain techaro.lol",
options: Options{CookieDomain: "techaro.lol"},
name: "domain sad.ovh",
options: Options{CookieDomain: "sad.ovh"},
host: "",
cookieName: anubis.CookieName,
cookieName: nuke.CookieName,
},
{
name: "dynamic cookie domain",
options: Options{CookieDynamicDomain: true},
host: "techaro.lol",
cookieName: anubis.CookieName,
host: "sad.ovh",
cookieName: nuke.CookieName,
},
} {
t.Run(tt.name, func(t *testing.T) {
srv := spawnAnubis(t, tt.options)
srv := spawnNuke(t, tt.options)
rw := httptest.NewRecorder()
srv.SetCookie(rw, CookieOpts{Value: "test", Host: tt.host})
@ -55,7 +55,7 @@ func TestSetCookie(t *testing.T) {
}
func TestClearCookie(t *testing.T) {
srv := spawnAnubis(t, Options{})
srv := spawnNuke(t, Options{})
rw := httptest.NewRecorder()
srv.ClearCookie(rw, CookieOpts{Host: "localhost"})
@ -70,8 +70,8 @@ func TestClearCookie(t *testing.T) {
ckie := cookies[0]
if ckie.Name != anubis.CookieName {
t.Errorf("wanted cookie named %q, got cookie named %q", anubis.CookieName, ckie.Name)
if ckie.Name != nuke.CookieName {
t.Errorf("wanted cookie named %q, got cookie named %q", nuke.CookieName, ckie.Name)
}
if ckie.MaxAge != -1 {
@ -80,7 +80,7 @@ func TestClearCookie(t *testing.T) {
}
func TestClearCookieWithDomain(t *testing.T) {
srv := spawnAnubis(t, Options{CookieDomain: "techaro.lol"})
srv := spawnNuke(t, Options{CookieDomain: "sad.ovh"})
rw := httptest.NewRecorder()
srv.ClearCookie(rw, CookieOpts{Host: "localhost"})
@ -95,8 +95,8 @@ func TestClearCookieWithDomain(t *testing.T) {
ckie := cookies[0]
if ckie.Name != anubis.CookieName {
t.Errorf("wanted cookie named %q, got cookie named %q", anubis.CookieName, ckie.Name)
if ckie.Name != nuke.CookieName {
t.Errorf("wanted cookie named %q, got cookie named %q", nuke.CookieName, ckie.Name)
}
if ckie.MaxAge != -1 {
@ -105,7 +105,7 @@ func TestClearCookieWithDomain(t *testing.T) {
}
func TestClearCookieWithDynamicDomain(t *testing.T) {
srv := spawnAnubis(t, Options{CookieDynamicDomain: true})
srv := spawnNuke(t, Options{CookieDynamicDomain: true})
rw := httptest.NewRecorder()
srv.ClearCookie(rw, CookieOpts{Host: "subdomain.xeiaso.net"})
@ -120,8 +120,8 @@ func TestClearCookieWithDynamicDomain(t *testing.T) {
ckie := cookies[0]
if ckie.Name != anubis.CookieName {
t.Errorf("wanted cookie named %q, got cookie named %q", anubis.CookieName, ckie.Name)
if ckie.Name != nuke.CookieName {
t.Errorf("wanted cookie named %q, got cookie named %q", nuke.CookieName, ckie.Name)
}
if ckie.Domain != "xeiaso.net" {
@ -136,7 +136,7 @@ func TestClearCookieWithDynamicDomain(t *testing.T) {
func TestRenderIndexRedirect(t *testing.T) {
s := &Server{
opts: Options{
PublicUrl: "https://anubis.example.com",
PublicUrl: "https://nuke.example.com",
},
}
req := httptest.NewRequest("GET", "/", nil)
@ -161,7 +161,7 @@ func TestRenderIndexRedirect(t *testing.T) {
t.Errorf("expected scheme to be %q, got %q", scheme, parsedURL.Scheme)
}
host := "anubis.example.com"
host := "nuke.example.com"
if parsedURL.Host != host {
t.Errorf("expected url to be %q, got %q", host, parsedURL.Host)
}