Compare commits
2 Commits
693e61d7d4
...
2824ee4c62
Author | SHA1 | Date |
---|---|---|
AJ ONeal | 2824ee4c62 | 5 years ago |
AJ ONeal | e7a02191d8 | 5 years ago |
3 changed files with 42 additions and 4 deletions
@ -0,0 +1,32 @@ |
|||||
|
package manager |
||||
|
|
||||
|
import ( |
||||
|
"fmt" |
||||
|
"io/ioutil" |
||||
|
"os" |
||||
|
"path/filepath" |
||||
|
"testing" |
||||
|
) |
||||
|
|
||||
|
func TestEmptyUserServicePath(t *testing.T) { |
||||
|
srvs, err := getUserSrvs("/tmp/fakeuser") |
||||
|
if nil != err { |
||||
|
t.Fatal(err) |
||||
|
} |
||||
|
if len(srvs) > 0 { |
||||
|
t.Fatal(fmt.Errorf("sanity fail: shouldn't get services from empty directory")) |
||||
|
} |
||||
|
|
||||
|
dirs, err := ioutil.ReadDir(filepath.Join("/tmp/fakeuser", srvUserPath)) |
||||
|
if nil != err { |
||||
|
t.Fatal(err) |
||||
|
} |
||||
|
if len(dirs) > 0 { |
||||
|
t.Fatal(fmt.Errorf("sanity fail: shouldn't get listing from empty directory")) |
||||
|
} |
||||
|
|
||||
|
err = os.RemoveAll("/tmp/fakeuser") |
||||
|
if nil != err { |
||||
|
panic("couldn't remove /tmp/fakeuser") |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue