mirror of
https://github.com/trufflesecurity/trufflehog.git
synced 2024-11-10 07:04:24 +00:00
363ccab316
* Simplify temp dir cleaning * rename vars * add test * update test
30 lines
527 B
Go
30 lines
527 B
Go
package cleantemp
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/mitchellh/go-ps"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestExecName(t *testing.T) {
|
|
executablePath, err := os.Executable()
|
|
assert.Nil(t, err)
|
|
execName := filepath.Base(executablePath)
|
|
assert.Equal(t, "cleantemp.test", execName)
|
|
|
|
procs, err := ps.Processes()
|
|
assert.Nil(t, err)
|
|
assert.NotEmpty(t, procs)
|
|
|
|
found := false
|
|
for _, proc := range procs {
|
|
if proc.Executable() == execName {
|
|
found = true
|
|
}
|
|
}
|
|
|
|
assert.True(t, found)
|
|
}
|