address feedback

This commit is contained in:
Laura Bennett 2016-10-09 22:23:30 -04:00
parent 05519a1267
commit 9fc5a37e84
2 changed files with 78 additions and 80 deletions

View File

@ -26,26 +26,22 @@ func TestAuditFile_fileModeNew(t *testing.T) {
Salt: salter,
Config: config,
})
if err != nil {
t.Fatalf("%v", err)
t.Fatalf(err)
}
defer os.Remove(file)
info,_ := os.Stat(file)
info, _ := os.Stat(file)
createdMode := info.Mode()
if createdMode != os.FileMode(mode) {
t.Fatalf("File Mode does not match.")
}
err = os.Remove(file)
}
func TestAuditFile_fileModeExisting(t *testing.T) {
salter, _ := salt.NewSalt(nil, nil)
modeStr := "0600"
m, err := strconv.ParseUint(modeStr, 8, 32)
mode := os.FileMode(m)
mode := os.FileMode(0600)
file := "auditTest.txt"
@ -54,6 +50,7 @@ func TestAuditFile_fileModeExisting(t *testing.T) {
if err != nil {
t.Fatalf("Failure to close the file.")
}
defer os.Remove(file)
config := map[string]string{
"path": file,
@ -63,16 +60,16 @@ func TestAuditFile_fileModeExisting(t *testing.T) {
Salt: salter,
Config: config,
})
if err != nil {
t.Fatalf("%v", err)
t.Fatalf(err)
}
info,_ := os.Stat(file)
info, err := os.Stat(file)
if err != nil {
t.Fatalf("cannot retrieve file mode from `Stat`")
}
createdMode := info.Mode()
if createdMode != mode {
t.Fatalf("File Mode does not match.")
}
err = os.Remove(file)
}

View File

@ -73,8 +73,9 @@ Following are the configuration options available for the backend.
<li>
<span class="param">mode</span>
<span class="param-flags">optional</span>
An unsigned integer, if provided, represents the file mode and
permissions. This option defaults to `0600`.
A string containing an octal number representing the bit pattern
for the file mode, similar to `chmod`. This option defaults to
`0600`.
</li>
<li>
<span class="param">format</span>