mirror of
https://github.com/kopia/kopia.git
synced 2026-03-09 09:46:21 -04:00
* ui: changed how PolicyEditor is instantiated via a route * server: added paths/resolve API * server: refresh affected source manager after policy change Also switched 15-second refresh cycle which is way too aggressive to 30-minute cycle (manual refresh button can be used if needed). * policy: allow overriding top-level policy for estimation * server: changed source create API to always require policy * ui: streamlined new snapshot and estimate flow * linter fix
37 lines
1015 B
Go
37 lines
1015 B
Go
package server_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/kopia/kopia/internal/apiclient"
|
|
"github.com/kopia/kopia/internal/repotesting"
|
|
"github.com/kopia/kopia/internal/serverapi"
|
|
"github.com/kopia/kopia/internal/testutil"
|
|
)
|
|
|
|
func TestPathsAPI(t *testing.T) {
|
|
ctx, env := repotesting.NewEnvironment(t, repotesting.FormatNotImportant)
|
|
srvInfo := startServer(t, env, false)
|
|
|
|
cli, err := apiclient.NewKopiaAPIClient(apiclient.Options{
|
|
BaseURL: srvInfo.BaseURL,
|
|
TrustedServerCertificateFingerprint: srvInfo.TrustedServerCertificateFingerprint,
|
|
Username: testUIUsername,
|
|
Password: testUIPassword,
|
|
})
|
|
|
|
require.NoError(t, err)
|
|
|
|
dir0 := testutil.TempDirectory(t)
|
|
|
|
req := &serverapi.ResolvePathRequest{
|
|
Path: dir0,
|
|
}
|
|
resp := &serverapi.ResolvePathResponse{}
|
|
require.NoError(t, cli.Post(ctx, "paths/resolve", req, resp))
|
|
|
|
require.Equal(t, localSource(env, dir0), resp.SourceInfo)
|
|
}
|