Fix: JSON error check

This commit is contained in:
Daniel Hougaard
2024-04-17 15:17:08 +02:00
parent bcb3eaab74
commit cb6cbafcae
2 changed files with 16 additions and 4 deletions

View File

@@ -33,7 +33,10 @@ func ListSecretsWithImportsAndRecursive(t *testing.T, authToken string, projectI
var secrets []models.SingleEnvironmentVariable
json.Unmarshal(commandOutput.Bytes(), &secrets)
err := json.Unmarshal(commandOutput.Bytes(), &secrets)
if err != nil {
t.Errorf("Error: %v", err)
}
if len(secrets) == 0 {
t.Errorf("No secrets found")
@@ -79,7 +82,10 @@ func GetSecretsByNames(t *testing.T, authToken string, projectId string, envSlug
var secrets []models.SingleEnvironmentVariable
json.Unmarshal(commandOutput.Bytes(), &secrets)
err := json.Unmarshal(commandOutput.Bytes(), &secrets)
if err != nil {
t.Errorf("Error: %v", err)
}
assert.Len(t, secrets, len(ALL_SECRETS))