mirror of
https://github.com/photoprism/photoprism.git
synced 2025-10-27 19:00:32 +08:00
Config: Add option to show filesystem usage in sidebar navigation #4266
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
28
internal/config/config_usage_test.go
Normal file
28
internal/config/config_usage_test.go
Normal 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())
|
||||
}
|
||||
Reference in New Issue
Block a user