Skip to content
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

Fix SCIM query params #2680

Merged
merged 7 commits into from Mar 9, 2023
Merged

Fix SCIM query params #2680

merged 7 commits into from Mar 9, 2023

Conversation

exageraldo
Copy link
Contributor

@exageraldo exageraldo commented Feb 27, 2023

Fixes: #2679

@google-cla
Copy link

google-cla bot commented Feb 27, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@codecov
Copy link

codecov bot commented Feb 27, 2023

Codecov Report

Merging #2680 (f8b4ff5) into master (862134b) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #2680   +/-   ##
=======================================
  Coverage   98.05%   98.05%           
=======================================
  Files         131      131           
  Lines       11457    11457           
=======================================
  Hits        11234    11234           
  Misses        152      152           
  Partials       71       71           
Impacted Files Coverage Δ
github/scim.go 100.00% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

func testAddOptions(t *testing.T, url string, v interface{}, want string) {
t.Helper()

u, err := addOptions(url, v)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
u, err := addOptions(url, v)
got, err := addOptions(url, v)

}

if u != want {
t.Errorf("addOptions(%q, %#v) returned %s, want %s", url, v, u, want)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
t.Errorf("addOptions(%q, %#v) returned %s, want %s", url, v, u, want)
t.Errorf("addOptions(%q, %#v) returned %v, want %v", url, v, got, want)

github/scim_test.go Show resolved Hide resolved
@@ -169,6 +169,19 @@ func testJSONMarshal(t *testing.T, v interface{}, want string) {
}
}

func testAddOptions(t *testing.T, url string, v interface{}, want string) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the structures passed in must have "url" tags in the fields (more in addOptions), is it valid to test if the fields have this tag?

Something like this:

st := reflect.TypeOf(v)
for i := 0; i < st.NumField(); i++ {
	field := st.Field(i)
	if alias, ok := field.Tag.Lookup("url"); ok {
		if alias == "" {
			// t.Errorf("...")
		}
	} else {
		// t.Errorf("...")
	}
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Please add a comment before line 172 that describes this requirement so that people will not start adding testAddOptions to every test.

In fact, let's make the function name more descriptive. How about testAddURLOptions ?

Copy link
Collaborator

@gmlewis gmlewis Mar 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe testAddURLTags ?

@exageraldo exageraldo marked this pull request as ready for review March 7, 2023 23:09
func TestListSCIMProvisionedIdentitiesOptions_Marshal(t *testing.T) {
testJSONMarshal(t, &ListSCIMProvisionedIdentitiesOptions{}, `{}`)
func TestListSCIMProvisionedIdentitiesOptions_addOptions(t *testing.T) {
testJSONMarshal(t, &ListSCIMProvisionedIdentitiesOptions{}, `{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, now I understand why you removed this before, as it really is no longer relevant.
Feel free to delete this if you wish, either in this PR or in your upcoming one.

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @exageraldo !
LGTM.

Awaiting second LGTM+Approval from any other contributor to this repo before merging.

@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label Mar 8, 2023
Copy link
Contributor

@valbeat valbeat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label Mar 9, 2023
@gmlewis gmlewis changed the title SCIM query params Fix SCIM query params Mar 9, 2023
@gmlewis
Copy link
Collaborator

gmlewis commented Mar 9, 2023

Thank you, @valbeat !
Merging.

@gmlewis gmlewis merged commit 9bfbc00 into google:master Mar 9, 2023
exageraldo added a commit to exageraldo/go-github that referenced this pull request Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SCIM routes pagination
3 participants