cookie ready
This commit is contained in:
@@ -17,3 +17,31 @@ func TestDeriveCookieNameMatchesFallbackPrestashopRule(t *testing.T) {
|
||||
t.Fatalf("DeriveCookieName() = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeriveCookieNameUsesDomainCookieOverride(t *testing.T) {
|
||||
cfg := Config{
|
||||
PrestaShopVersion: "1.7.3",
|
||||
DomainCookie: ".example.com",
|
||||
}
|
||||
|
||||
got := cfg.DeriveCookieName("localhost")
|
||||
sum := md5.Sum([]byte("1.7.3" + "ps-s1" + "example.com"))
|
||||
want := fmt.Sprintf("PrestaShop-%x", sum)
|
||||
|
||||
if got != want {
|
||||
t.Fatalf("DeriveCookieName() = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeriveCookieNamePrefersExplicitCookieName(t *testing.T) {
|
||||
cfg := Config{
|
||||
PrestaShopVersion: "1.7.3",
|
||||
DomainCookie: ".example.com",
|
||||
PrestaShopCookieName: "PrestaShop-fixed",
|
||||
}
|
||||
|
||||
got := cfg.DeriveCookieName("localhost")
|
||||
if got != "PrestaShop-fixed" {
|
||||
t.Fatalf("DeriveCookieName() = %q, want %q", got, "PrestaShop-fixed")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user