Files
URBM/internal/platform/mounts_test.go
T

33 lines
946 B
Go

package platform
import (
"context"
"path/filepath"
"testing"
"git.casaderoll.de/michael/urbm/internal/model"
)
func TestExternalMountAllowsNewRepositorySubdirectory(t *testing.T) {
base := t.TempDir()
repo := model.Repository{Type: model.RepositorySMB, Location: filepath.Join(base, "Photos")}
manager := &MountManager{}
mounted, err := manager.Prepare(context.Background(), repo)
if err != nil {
t.Fatalf("new repository subdirectory rejected: %v", err)
}
if mounted.Repository.Location != repo.Location {
t.Fatalf("location = %q, want %q", mounted.Repository.Location, repo.Location)
}
}
func TestExternalMountRejectsMissingBaseDirectory(t *testing.T) {
repo := model.Repository{Type: model.RepositoryNFS, Location: filepath.Join(t.TempDir(), "missing", "Photos")}
manager := &MountManager{}
if _, err := manager.Prepare(context.Background(), repo); err == nil {
t.Fatal("missing external mount base accepted")
}
}