owner_test.go 537 B

1234567891011121314151617181920212223242526272829303132333435
  1. package main
  2. import (
  3. "testing"
  4. "os"
  5. )
  6. func TestOwnerPath(t *testing.T) {
  7. opts, _ = defaultOptions()
  8. p, err := ownerPath("testName")
  9. if err != nil {
  10. t.Error()
  11. }
  12. pwd, _ := os.Getwd()
  13. if pwd != p {
  14. t.Error()
  15. }
  16. opts.ClonePath = "test"
  17. p, err = ownerPath("nameToIgnore")
  18. if p != "test" {
  19. t.Error()
  20. }
  21. }
  22. func TestNewOwner(t *testing.T) {
  23. opts, _ = defaultOptions()
  24. owner := newOwner()
  25. // default options will assume gitleaks is
  26. // running on local mode
  27. pwd, _ := os.Getwd()
  28. if pwd != owner.path {
  29. t.Error()
  30. }
  31. }