gitlab_test.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.
  11. */
  12. package gitlab
  13. // NOT WORKING CURRENTLY
  14. // func TestCreateGitlabClient(t *testing.T) {
  15. // credentials := GitlabCredentials{Token: GITLAB_TOKEN}
  16. // gitlab := NewGitlabProvider()
  17. // gitlab.SetAuth(credentials, GITLAB_PROJECT_ID)
  18. // // user, _, _ := gitlab.client.Users.CurrentUser()
  19. // // fmt.Printf("Created client for username: %v", user)
  20. // }
  21. // func TestGetSecret(t *testing.T) {
  22. // ctx := context.Background()
  23. // ref := v1alpha1.ExternalSecretDataRemoteRef{Key: "mySecretBanana"}
  24. // credentials := GitlabCredentials{Token: GITLAB_TOKEN}
  25. // gitlab := NewGitlabProvider()
  26. // gitlab.SetAuth(credentials, GITLAB_PROJECT_ID)
  27. // secretData, err := gitlab.GetSecret(ctx, ref)
  28. // if err != nil {
  29. // fmt.Errorf("error retrieving secret, %w", err)
  30. // }
  31. // fmt.Printf("Got secret data %v", string(secretData))
  32. // }
  33. // func TestGetSecretMap(t *testing.T) {
  34. // ctx := context.Background()
  35. // ref := v1alpha1.ExternalSecretDataRemoteRef{Key: "myJsonSecret"}
  36. // credentials := GitlabCredentials{Token: GITLAB_TOKEN}
  37. // gitlab := NewGitlabProvider()
  38. // gitlab.SetAuth(credentials, GITLAB_PROJECT_ID)
  39. // secretData, err := gitlab.GetSecretMap(ctx, ref)
  40. // if err != nil {
  41. // fmt.Errorf("error retrieving secret map, %w", err)
  42. // }
  43. // fmt.Printf("Got secret map: %v", secretData)
  44. // }