From 97dd77445d05c29729888dd7bba2238f222d34dc Mon Sep 17 00:00:00 2001 From: Sayali Deshmukh Date: Tue, 25 Oct 2022 08:38:32 -0400 Subject: [PATCH 1/3] Added test cases for JSON resource marshaling --- github/scim_test.go | 56 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/github/scim_test.go b/github/scim_test.go index 7c6e14078b..e25f18352e 100644 --- a/github/scim_test.go +++ b/github/scim_test.go @@ -389,3 +389,59 @@ func TestSCIMUserAttributes_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestUpdateAttributeForSCIMUserOperations_Marshal(t *testing.T) { + testJSONMarshal(t, &UpdateAttributeForSCIMUserOperations{}, `{}`) + + u := &UpdateAttributeForSCIMUserOperations{ + Op: "TestOp", + Path: String("path"), + } + + want := `{ + "op":"TestOp", + "path": "path" + }` + + testJSONMarshal(t, u, want) +} + +func TestUpdateAttributeForSCIMUserOptions_Marshal(t *testing.T) { + testJSONMarshal(t, &UpdateAttributeForSCIMUserOptions{}, `{}`) + + u := &UpdateAttributeForSCIMUserOptions{ + Schemas: []string{"test", "schema"}, + Operations: UpdateAttributeForSCIMUserOperations{ + Op: "TestOp", + Path: String("path"), + }, + } + + want := `{ + "schemas":["test", "schema"], + "operations":{ + "op":"TestOp", + "path": "path" + } + }` + + testJSONMarshal(t, u, want) +} + +func TestListSCIMProvisionedIdentitiesOptions_Marshal(t *testing.T) { + testJSONMarshal(t, &ListSCIMProvisionedIdentitiesOptions{}, `{}`) + + u := &ListSCIMProvisionedIdentitiesOptions{ + StartIndex: Int(1), + Count: Int(10), + Filter: String("test"), + } + + want := `{ + "startIndex":1, + "count": 10, + "filter":"test" + }` + + testJSONMarshal(t, u, want) +} From 91e50dc8f6aec56245134c2c2b518ce04704ab78 Mon Sep 17 00:00:00 2001 From: Sayali Deshmukh Date: Tue, 25 Oct 2022 10:28:01 -0400 Subject: [PATCH 2/3] Addressed review comments --- github/scim_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/github/scim_test.go b/github/scim_test.go index e25f18352e..fe7e3bdb27 100644 --- a/github/scim_test.go +++ b/github/scim_test.go @@ -399,7 +399,7 @@ func TestUpdateAttributeForSCIMUserOperations_Marshal(t *testing.T) { } want := `{ - "op":"TestOp", + "op": "TestOp", "path": "path" }` @@ -418,9 +418,9 @@ func TestUpdateAttributeForSCIMUserOptions_Marshal(t *testing.T) { } want := `{ - "schemas":["test", "schema"], + "schemas": ["test", "schema"], "operations":{ - "op":"TestOp", + "op": "TestOp", "path": "path" } }` @@ -438,9 +438,9 @@ func TestListSCIMProvisionedIdentitiesOptions_Marshal(t *testing.T) { } want := `{ - "startIndex":1, + "startIndex": 1, "count": 10, - "filter":"test" + "filter": "test" }` testJSONMarshal(t, u, want) From 4d4f633619d150aa250abad65b83efb1af0ad3bf Mon Sep 17 00:00:00 2001 From: Sayali Deshmukh Date: Tue, 25 Oct 2022 10:29:50 -0400 Subject: [PATCH 3/3] Addressed review comments --- github/scim_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/scim_test.go b/github/scim_test.go index fe7e3bdb27..5b95f2eaab 100644 --- a/github/scim_test.go +++ b/github/scim_test.go @@ -419,7 +419,7 @@ func TestUpdateAttributeForSCIMUserOptions_Marshal(t *testing.T) { want := `{ "schemas": ["test", "schema"], - "operations":{ + "operations": { "op": "TestOp", "path": "path" }