NUKE
Some checks failed
Docker image builds / build (push) Failing after 4m22s

This commit is contained in:
Soph :3 2026-02-07 14:27:38 +02:00
parent d2205b11a7
commit 02b9aebbe5
341 changed files with 1571 additions and 32574 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)
}