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

Add test cases for JSON resource marshaling #2524

Merged
merged 4 commits into from Oct 25, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
56 changes: 56 additions & 0 deletions github/scim_test.go
Expand Up @@ -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)
}