Skip to content

Commit

Permalink
Fix failing template credentials tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Acconut committed Nov 22, 2024
1 parent 8f7c294 commit 68e8b4d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions template_credentials_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ func TestTemplateCredentials(t *testing.T) {
if templateCredential, err = client.GetTemplateCredential(ctx, id); err != nil {
t.Error(err)
}
checkTemplateCredential(t, templateCredential, templateCredentialName, templateCredentialContent)
checkTemplateCredential(t, templateCredential, templateCredentialName, templateCredentialContent, "s3")

// Step 3: List all Templated credentials and assume that the created templateCredential is present
// Step 3: List all Template credentials and assume that the created templateCredential is present
list, err := client.ListTemplateCredential(ctx, nil)
if err != nil {
t.Error(err)
}
found := false
for _, cred := range list.TemplateCredential {
if cred.ID == id {
checkTemplateCredential(t, cred, templateCredentialName, templateCredentialContent)
checkTemplateCredential(t, cred, templateCredentialName, templateCredentialContent, "s3")
found = true
}
}
Expand Down Expand Up @@ -74,7 +74,7 @@ func TestTemplateCredentials(t *testing.T) {
if newTemplateCredential, err = client.GetTemplateCredential(ctx, id); err != nil {
t.Error(err)
}
checkTemplateCredential(t, newTemplateCredential, newtemplateCredentialName, newtemplateCredentialContent)
checkTemplateCredential(t, newTemplateCredential, newtemplateCredentialName, newtemplateCredentialContent, "backblaze")

// Step 6: Delete test templateCredential
if err := client.DeleteTemplateCredential(ctx, id); err != nil {
Expand All @@ -88,11 +88,11 @@ func TestTemplateCredentials(t *testing.T) {
}
}

func checkTemplateCredential(t *testing.T, cred TemplateCredential, templateCredentialName string, expected map[string]interface{}) {
func checkTemplateCredential(t *testing.T, cred TemplateCredential, templateCredentialName string, expected map[string]interface{}, expectedType string) {
if cred.Name != templateCredentialName {
t.Error("wrong templateCredentialPost name")
}
if cred.Type != "s3" {
if cred.Type != expectedType {
t.Error("wrong templateCredentialPost type")
}
if !reflect.DeepEqual(cred.Content, expected) {
Expand Down

0 comments on commit 68e8b4d

Please sign in to comment.