29 lines
551 B
Go
29 lines
551 B
Go
|
|
package api
|
||
|
|
|
||
|
|
import (
|
||
|
|
"testing"
|
||
|
|
|
||
|
|
"codeberg.org/romaintb/fgj/internal/config"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestClient_Hostname(t *testing.T) {
|
||
|
|
client := &Client{
|
||
|
|
hostname: "codeberg.org",
|
||
|
|
}
|
||
|
|
|
||
|
|
if client.Hostname() != "codeberg.org" {
|
||
|
|
t.Errorf("Expected hostname 'codeberg.org', got '%s'", client.Hostname())
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func TestNewClientFromConfig_MissingHost(t *testing.T) {
|
||
|
|
cfg := &config.Config{
|
||
|
|
Hosts: map[string]config.HostConfig{},
|
||
|
|
}
|
||
|
|
|
||
|
|
_, err := NewClientFromConfig(cfg, "nonexistent.org")
|
||
|
|
if err == nil {
|
||
|
|
t.Error("Expected error for nonexistent host")
|
||
|
|
}
|
||
|
|
}
|