mirror of https://github.com/pkg/sftp.git
minor improvements to some test cases
TestRequestReadlink: use "/does-not-exist" to test readlink on non-existent file. TestRequestAttributes: use 0700 for perm attrs instead of 700
This commit is contained in:
parent
43b3a5532d
commit
c4323ce9f2
|
@ -36,17 +36,17 @@ func TestRequestAttributes(t *testing.T) {
|
||||||
testFs, _ := unmarshalFileStat(fl, at)
|
testFs, _ := unmarshalFileStat(fl, at)
|
||||||
assert.Equal(t, fa, *testFs)
|
assert.Equal(t, fa, *testFs)
|
||||||
// Size and Mode
|
// Size and Mode
|
||||||
fa = FileStat{Mode: 700, Size: 99}
|
fa = FileStat{Mode: 0700, Size: 99}
|
||||||
fl = uint32(sshFileXferAttrSize | sshFileXferAttrPermissions)
|
fl = uint32(sshFileXferAttrSize | sshFileXferAttrPermissions)
|
||||||
at = []byte{}
|
at = []byte{}
|
||||||
at = marshalUint64(at, 99)
|
at = marshalUint64(at, 99)
|
||||||
at = marshalUint32(at, 700)
|
at = marshalUint32(at, 0700)
|
||||||
testFs, _ = unmarshalFileStat(fl, at)
|
testFs, _ = unmarshalFileStat(fl, at)
|
||||||
assert.Equal(t, fa, *testFs)
|
assert.Equal(t, fa, *testFs)
|
||||||
// FileMode
|
// FileMode
|
||||||
assert.True(t, testFs.FileMode().IsRegular())
|
assert.True(t, testFs.FileMode().IsRegular())
|
||||||
assert.False(t, testFs.FileMode().IsDir())
|
assert.False(t, testFs.FileMode().IsDir())
|
||||||
assert.Equal(t, testFs.FileMode().Perm(), os.FileMode(700).Perm())
|
assert.Equal(t, testFs.FileMode().Perm(), os.FileMode(0700).Perm())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRequestAttributesEmpty(t *testing.T) {
|
func TestRequestAttributesEmpty(t *testing.T) {
|
||||||
|
|
|
@ -762,7 +762,7 @@ func TestRequestReadlink(t *testing.T) {
|
||||||
_, err = p.cli.ReadLink("/foo")
|
_, err = p.cli.ReadLink("/foo")
|
||||||
assert.Error(t, err, "Readlink on non-symlink should fail")
|
assert.Error(t, err, "Readlink on non-symlink should fail")
|
||||||
|
|
||||||
_, err = p.cli.ReadLink("/foobar")
|
_, err = p.cli.ReadLink("/does-not-exist")
|
||||||
assert.Error(t, err, "Readlink on non-existent file should fail")
|
assert.Error(t, err, "Readlink on non-existent file should fail")
|
||||||
|
|
||||||
checkRequestServerAllocator(t, p)
|
checkRequestServerAllocator(t, p)
|
||||||
|
|
Loading…
Reference in New Issue