|
|
@ -105,3 +105,31 @@ func TestPathStrictMode(t *testing.T) {
|
|
|
|
err = s.SaveFile(ref, ns_file, int64(ns_file.Len()))
|
|
|
|
err = s.SaveFile(ref, ns_file, int64(ns_file.Len()))
|
|
|
|
is.Equal(err, swampfile.ErrUnacceptablePath)
|
|
|
|
is.Equal(err, swampfile.ErrUnacceptablePath)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestQuotaWithContenSizeLieOver(t *testing.T) {
|
|
|
|
|
|
|
|
is := is.New(t)
|
|
|
|
|
|
|
|
s := NewTestSwampFileService()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
largefakefile := bytes.NewBufferString("")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for largefakefile.Len() < 64000 {
|
|
|
|
|
|
|
|
_, _ = largefakefile.WriteString("A very repetitive file")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
err := s.SaveFile(file_ref3, largefakefile, int64(10))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
is.Equal(err, swampfile.ErrContentSizeExceeded)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestQuotaWithContenSizeLieUnder(t *testing.T) {
|
|
|
|
|
|
|
|
is := is.New(t)
|
|
|
|
|
|
|
|
s := NewTestSwampFileService()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
largefakefile := bytes.NewBufferString("small")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
err := s.SaveFile(file_ref3, largefakefile, int64(1024))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
is.Equal(err, swampfile.ErrContentSizeExaggerated)
|
|
|
|
|
|
|
|
}
|
|
|
|