GitOps for k8s
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

url_test.go 426B

1234567891011121314151617181920
  1. package git
  2. import (
  3. "strings"
  4. "testing"
  5. )
  6. func TestSafeURL(t *testing.T) {
  7. const password = "abc123"
  8. for _, url := range []string{
  9. "git@github.com:weaveworks/flux",
  10. "https://user@example.com:5050/repo.git",
  11. "https://user:" + password + "@example.com:5050/repo.git",
  12. } {
  13. u := Remote{url}
  14. if strings.Contains(u.SafeURL(), password) {
  15. t.Errorf("Safe URL for %s contains password %q", url, password)
  16. }
  17. }
  18. }