MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / TestIsEncrypt

Function TestIsEncrypt

server/handles/fsread_test.go:175–255  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

173}
174
175func TestIsEncrypt(t *testing.T) {
176 tests := []struct {
177 name string
178 meta *model.Meta
179 path string
180 want bool
181 reason string
182 }{
183 {
184 name: "nil meta",
185 meta: nil,
186 path: "/any",
187 want: false,
188 reason: "nil meta should not be encrypted",
189 },
190 {
191 name: "empty password",
192 meta: &model.Meta{
193 Path: "/folder",
194 Password: "",
195 },
196 path: "/folder",
197 want: false,
198 reason: "empty password should not be encrypted",
199 },
200 {
201 name: "exact path match with PSub=false",
202 meta: &model.Meta{
203 Path: "/folder",
204 Password: "secret",
205 PSub: false,
206 },
207 path: "/folder",
208 want: true,
209 reason: "exact path with password should be encrypted",
210 },
211 {
212 name: "sub path with PSub=true",
213 meta: &model.Meta{
214 Path: "/folder",
215 Password: "secret",
216 PSub: true,
217 },
218 path: "/folder/subfolder",
219 want: true,
220 reason: "sub path with PSub=true should be encrypted",
221 },
222 {
223 name: "sub path with PSub=false",
224 meta: &model.Meta{
225 Path: "/folder",
226 Password: "secret",
227 PSub: false,
228 },
229 path: "/folder/subfolder",
230 want: false,
231 reason: "sub path with PSub=false should not be encrypted",
232 },

Callers

nothing calls this directly

Calls 2

isEncryptFunction · 0.70
RunMethod · 0.65

Tested by

no test coverage detected