MCPcopy
hub / github.com/syncthing/syncthing / TestAutoAcceptExistingFolder

Function TestAutoAcceptExistingFolder

lib/model/model_test.go:1144–1168  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1142}
1143
1144func TestAutoAcceptExistingFolder(t *testing.T) {
1145 // Existing folder
1146 id := srand.String(8)
1147 idOther := srand.String(8) // To check that path does not get changed.
1148
1149 tcfg := defaultAutoAcceptCfg.Copy()
1150 tcfg.Folders = []config.FolderConfiguration{
1151 {
1152 FilesystemType: config.FilesystemTypeFake,
1153 ID: id,
1154 Path: idOther, // To check that path does not get changed.
1155 },
1156 }
1157 m, cancel := newState(t, tcfg)
1158 defer cleanupModel(m)
1159 defer cancel()
1160 if fcfg, ok := m.cfg.Folder(id); !ok || fcfg.SharedWith(device1) {
1161 t.Error("missing folder, or shared", id)
1162 }
1163 m.ClusterConfig(device1Conn, createClusterConfig(device1, id))
1164
1165 if fcfg, ok := m.cfg.Folder(id); !ok || !fcfg.SharedWith(device1) || fcfg.Path != idOther {
1166 t.Error("missing folder, or unshared, or path changed", id)
1167 }
1168}
1169
1170func TestAutoAcceptNewAndExistingFolder(t *testing.T) {
1171 // New and existing folder

Callers

nothing calls this directly

Calls 9

newStateFunction · 0.85
cleanupModelFunction · 0.85
createClusterConfigFunction · 0.85
SharedWithMethod · 0.80
StringMethod · 0.65
FolderMethod · 0.65
ErrorMethod · 0.65
ClusterConfigMethod · 0.65
CopyMethod · 0.45

Tested by

no test coverage detected