mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-06 02:36:49 +00:00
31 lines
813 B
Go
31 lines
813 B
Go
package storage
|
|
|
|
import "testing"
|
|
|
|
func TestNormalizeEndpoint_WithSchemeOverridesSecureFlag(t *testing.T) {
|
|
endpoint, secure, err := normalizeEndpoint("https://s3api.nemausat.com", false)
|
|
if err != nil {
|
|
t.Fatalf("unexpected error: %v", err)
|
|
}
|
|
|
|
if endpoint != "s3api.nemausat.com" {
|
|
t.Fatalf("expected normalized host, got %q", endpoint)
|
|
}
|
|
if !secure {
|
|
t.Fatal("expected https endpoint to force secure=true")
|
|
}
|
|
}
|
|
|
|
func TestNormalizeEndpoint_WithoutSchemePreservesSecureFlag(t *testing.T) {
|
|
endpoint, secure, err := normalizeEndpoint("s3api.nemausat.com", true)
|
|
if err != nil {
|
|
t.Fatalf("unexpected error: %v", err)
|
|
}
|
|
|
|
if endpoint != "s3api.nemausat.com" {
|
|
t.Fatalf("expected endpoint to be preserved, got %q", endpoint)
|
|
}
|
|
if !secure {
|
|
t.Fatal("expected secure flag to be preserved")
|
|
}
|
|
}
|