From e351bdfe1938c79de41ca1f017ea787365e03bdc Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Wed, 23 Jun 2021 00:18:40 +0530 Subject: [PATCH 1/7] Resource Tested for JSON marshalling : RunnerApplicationDownload --- github/actions_runners_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/github/actions_runners_test.go b/github/actions_runners_test.go index a3e3b28e82e..f17fed3fb6d 100644 --- a/github/actions_runners_test.go +++ b/github/actions_runners_test.go @@ -500,3 +500,27 @@ func TestActionsService_RemoveOrganizationRunner(t *testing.T) { return client.Actions.RemoveOrganizationRunner(ctx, "o", 21) }) } + +func TestRunnerApplicationDownload_Marshal(t *testing.T) { + testJSONMarshal(t, &RunnerApplicationDownload{}, "{}") + + u := &RunnerApplicationDownload{ + OS: String("o"), + Architecture: String("a"), + DownloadURL: String("d"), + Filename: String("f"), + TempDownloadToken: String("t"), + SHA256Checksum: String("s"), + } + + want := `{ + "os": "o", + "architecture": "a", + "download_url": "d", + "filename": "f", + "temp_download_token": "t", + "sha256_checksum": "s" + }` + + testJSONMarshal(t, u, want) +} From 2a1c2ae964ad5009c435474c32b9300753c7da05 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Wed, 23 Jun 2021 00:37:50 +0530 Subject: [PATCH 2/7] Resource Tested for JSON marshalling : ActionsEnabledOnOrgRepos --- github/actions_runners_test.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/github/actions_runners_test.go b/github/actions_runners_test.go index f17fed3fb6d..8c14b965711 100644 --- a/github/actions_runners_test.go +++ b/github/actions_runners_test.go @@ -524,3 +524,31 @@ func TestRunnerApplicationDownload_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestActionsEnabledOnOrgRepos_Marshal(t *testing.T) { + testJSONMarshal(t, &ActionsEnabledOnOrgRepos{}, "{}") + + u := &ActionsEnabledOnOrgRepos{ + TotalCount: 1, + Repositories: []*Repository{ + { + ID: Int64(1), + URL: String("u"), + Name: String("n"), + }, + }, + } + + want := `{ + "total_count": 1, + "repositories": [ + { + "id": 1, + "url": "u", + "name": "n" + } + ] + }` + + testJSONMarshal(t, u, want) +} From 0a03107970ca3f28ab89f39f4ce983cb1194b005 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Wed, 23 Jun 2021 00:44:30 +0530 Subject: [PATCH 3/7] Resource Tested for JSON marshalling : RegistrationToken --- github/actions_runners_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/github/actions_runners_test.go b/github/actions_runners_test.go index 8c14b965711..fb2c0bccb0a 100644 --- a/github/actions_runners_test.go +++ b/github/actions_runners_test.go @@ -552,3 +552,19 @@ func TestActionsEnabledOnOrgRepos_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestRegistrationToken_Marshal(t *testing.T) { + testJSONMarshal(t, &RegistrationToken{}, "{}") + + u := &RegistrationToken{ + Token: String("t"), + ExpiresAt: &Timestamp{referenceTime}, + } + + want := `{ + "token": "t", + "expires_at": ` + referenceTimeStr + ` + }` + + testJSONMarshal(t, u, want) +} From fba3daddbea7e3605aa02bfd84fe5af4bf364940 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Wed, 23 Jun 2021 00:51:07 +0530 Subject: [PATCH 4/7] Resource Tested for JSON marshalling : RunnerLabels --- github/actions_runners_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/github/actions_runners_test.go b/github/actions_runners_test.go index fb2c0bccb0a..adb3e2e18e1 100644 --- a/github/actions_runners_test.go +++ b/github/actions_runners_test.go @@ -568,3 +568,21 @@ func TestRegistrationToken_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestRunnerLabels_Marshal(t *testing.T) { + testJSONMarshal(t, &RunnerLabels{}, "{}") + + u := &RunnerLabels{ + ID: Int64(1), + Name: String("n"), + Type: String("t"), + } + + want := `{ + "id": 1, + "name": "n", + "type": "t" + }` + + testJSONMarshal(t, u, want) +} From 25798e73209675605effec9479de99b6cb9d122f Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Wed, 23 Jun 2021 00:59:56 +0530 Subject: [PATCH 5/7] Resource Tested for JSON marshalling : Runner --- github/actions_runners_test.go | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/github/actions_runners_test.go b/github/actions_runners_test.go index adb3e2e18e1..67ed3657723 100644 --- a/github/actions_runners_test.go +++ b/github/actions_runners_test.go @@ -586,3 +586,39 @@ func TestRunnerLabels_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestRunner_Marshal(t *testing.T) { + testJSONMarshal(t, &RunnerLabels{}, "{}") + + u := &Runner{ + ID: Int64(1), + Name: String("n"), + OS: String("o"), + Status: String("s"), + Busy: Bool(false), + Labels: []*RunnerLabels{ + { + ID: Int64(1), + Name: String("n"), + Type: String("t"), + }, + }, + } + + want := `{ + "id": 1, + "name": "n", + "os": "o", + "status": "s", + "busy": false, + "labels": [ + { + "id": 1, + "name": "n", + "type": "t" + } + ] + }` + + testJSONMarshal(t, u, want) +} From f8fc7df1a7c0fd17bb6553724d5cf5a1bc1884c2 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Wed, 23 Jun 2021 01:08:15 +0530 Subject: [PATCH 6/7] Resource Tested for JSON marshalling : Runners --- github/actions_runners_test.go | 48 +++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/github/actions_runners_test.go b/github/actions_runners_test.go index 67ed3657723..ec5a98454d7 100644 --- a/github/actions_runners_test.go +++ b/github/actions_runners_test.go @@ -588,7 +588,7 @@ func TestRunnerLabels_Marshal(t *testing.T) { } func TestRunner_Marshal(t *testing.T) { - testJSONMarshal(t, &RunnerLabels{}, "{}") + testJSONMarshal(t, &Runner{}, "{}") u := &Runner{ ID: Int64(1), @@ -622,3 +622,49 @@ func TestRunner_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestRunners_Marshal(t *testing.T) { + testJSONMarshal(t, &Runners{}, "{}") + + u := &Runners{ + TotalCount: 1, + Runners: []*Runner{ + { + ID: Int64(1), + Name: String("n"), + OS: String("o"), + Status: String("s"), + Busy: Bool(false), + Labels: []*RunnerLabels{ + { + ID: Int64(1), + Name: String("n"), + Type: String("t"), + }, + }, + }, + }, + } + + want := `{ + "total_count": 1, + "runners": [ + { + "id": 1, + "name": "n", + "os": "o", + "status": "s", + "busy": false, + "labels": [ + { + "id": 1, + "name": "n", + "type": "t" + } + ] + } + ] + }` + + testJSONMarshal(t, u, want) +} From a61fb688679f67376c4c81640eefa693917cdf64 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Wed, 23 Jun 2021 01:13:09 +0530 Subject: [PATCH 7/7] Resource Tested for JSON marshalling : RemoveToken --- github/actions_runners_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/github/actions_runners_test.go b/github/actions_runners_test.go index ec5a98454d7..a997f627f89 100644 --- a/github/actions_runners_test.go +++ b/github/actions_runners_test.go @@ -668,3 +668,19 @@ func TestRunners_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestRemoveToken_Marshal(t *testing.T) { + testJSONMarshal(t, &RemoveToken{}, "{}") + + u := &RemoveToken{ + Token: String("t"), + ExpiresAt: &Timestamp{referenceTime}, + } + + want := `{ + "token": "t", + "expires_at": ` + referenceTimeStr + ` + }` + + testJSONMarshal(t, u, want) +}