From 33c3e88462f67857fba341a499b14c4ad3e8a133 Mon Sep 17 00:00:00 2001 From: Sayali Deshmukh <85864673+sayalideshmukh10@users.noreply.github.com> Date: Tue, 25 Oct 2022 10:54:51 -0400 Subject: [PATCH] Add test cases for JSON resource marshaling (#2524) --- github/scim_test.go | 57 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/github/scim_test.go b/github/scim_test.go index d00377a972..7665bb2b12 100644 --- a/github/scim_test.go +++ b/github/scim_test.go @@ -390,6 +390,62 @@ 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) +} + func TestSCIMUserName_Marshal(t *testing.T) { testJSONMarshal(t, &SCIMUserName{}, `{ "givenName":"","familyName":"" @@ -406,6 +462,5 @@ func TestSCIMUserName_Marshal(t *testing.T) { "familyName": "Fname", "formatted": "formatted name" }` - testJSONMarshal(t, u, want) }