Config: Add option to show filesystem usage in sidebar navigation #4266

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2025-03-03 20:05:56 +01:00
parent abfb19bd63
commit c2cc50b670
27 changed files with 469 additions and 55 deletions

View File

@@ -0,0 +1,28 @@
package config
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/photoprism/photoprism/pkg/fs/duf"
)
func TestConfig_Usage(t *testing.T) {
c := TestConfig()
c.options.UsageInfo = true
result := c.Usage()
assert.GreaterOrEqual(t, result.Used, uint64(60000000))
t.Logf("Storage Used: %d MB (%d%%), Free: %d MB (%d%%), Total %d MB", result.Used/duf.MB, result.UsedPct, result.Free/duf.MB, result.FreePct, result.Total/duf.MB)
c.options.UsageInfo = false
assert.Equal(t, c.Usage().Used, uint64(0))
}
func TestConfig_Quota(t *testing.T) {
c := TestConfig()
assert.Equal(t, uint64(0), c.Quota())
assert.Equal(t, 0, c.QuotaUsers())
}