From f909138345f1054a02d3f6589fcc1add28f14c00 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Mon, 12 Jul 2021 23:27:50 +0530 Subject: [PATCH] Resources Covered : - startUserMigration - UserMigration --- github/migrations_user_test.go | 54 ++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/github/migrations_user_test.go b/github/migrations_user_test.go index 8b421d84845..5a8905cd116 100644 --- a/github/migrations_user_test.go +++ b/github/migrations_user_test.go @@ -249,3 +249,57 @@ var wantUserMigration = &UserMigration{ }, }, } + +func TestUserMigration_Marshal(t *testing.T) { + testJSONMarshal(t, &UserMigration{}, "{}") + + u := &UserMigration{ + ID: Int64(1), + GUID: String("guid"), + State: String("state"), + LockRepositories: Bool(false), + ExcludeAttachments: Bool(false), + URL: String("url"), + CreatedAt: String("ca"), + UpdatedAt: String("ua"), + Repositories: []*Repository{{ID: Int64(1)}}, + } + + want := `{ + "id": 1, + "guid": "guid", + "state": "state", + "lock_repositories": false, + "exclude_attachments": false, + "url": "url", + "created_at": "ca", + "updated_at": "ua", + "repositories": [ + { + "id": 1 + } + ] + }` + + testJSONMarshal(t, u, want) +} + +func TestStartUserMigration_Marshal(t *testing.T) { + testJSONMarshal(t, &startUserMigration{}, "{}") + + u := &startUserMigration{ + Repositories: []string{"r"}, + LockRepositories: Bool(false), + ExcludeAttachments: Bool(false), + } + + want := `{ + "repositories": [ + "r" + ], + "lock_repositories": false, + "exclude_attachments": false + }` + + testJSONMarshal(t, u, want) +}