-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search Organization tags by name #705
Search Organization tags by name #705
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 Thanks so much for your contribution! I apologize for having taken so long to review these changes -- Some minor feedback below. I'll go ahead and rebase your PR onto a local branch so the changes can run against CI once the feedback is addressed. 👍
assert.Equal(t, 1, len(tags.Items)) | ||
|
||
for _, tag := range tags.Items { | ||
assert.Equal(t, tag.Name, testTagName) | ||
|
||
t.Run("ensure org relation is properly decoded", func(t *testing.T) { | ||
assert.NotNil(t, tag.Organization) | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use require.Len(t, tags.Items, 1)
as there is no point in continuing the rest of this test if that is not true. For context, require
will error and stop the execution of a test, whereas assert
will not.
The second item here is the for
loop is unnecessary as there should only be one item in the list. You also don't need a subtest for ensuring the Organization
relation is not nil (but I can leave that at your discretion). You can simplify to:
assert.Equal(t, tags.Items[0].Name, testTagName)
assert.NotNil(t, tags.Items[0].Organization)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sebasslash, Thank you for taking the time to review this PR.
I have updated the tests with your feedback, please let me know if this looks good! Cheers!
These changes are 👍 to merge 🚀 . Please see #720 which is the PR that will be merged, I will close this one. |
Description
Added support for the query parameter
q
described herehttps://developer.hashicorp.com/terraform/cloud-docs/api-docs/organization-tags#query-parameters
Testing plan
Output from tests