(t *testing.T)
| 77 | } |
| 78 | |
| 79 | func TestGitHubRepo_withParent(t *testing.T) { |
| 80 | httpReg := &httpmock.Registry{} |
| 81 | defer httpReg.Verify(t) |
| 82 | |
| 83 | httpReg.Register( |
| 84 | httpmock.GraphQL(`query RepositoryInfo\b`), |
| 85 | httpmock.StringResponse(` |
| 86 | { "data": { "repository": { |
| 87 | "id": "REPOID", |
| 88 | "name": "REPO", |
| 89 | "owner": {"login": "OWNER"}, |
| 90 | "sshUrl": "git@github.com:OWNER/REPO.git", |
| 91 | "hasIssuesEnabled": true, |
| 92 | "description": "", |
| 93 | "hasWikiEnabled": false, |
| 94 | "viewerPermission": "READ", |
| 95 | "defaultBranchRef": {"name": "main"}, |
| 96 | "parent": { |
| 97 | "id": "PARENTID", |
| 98 | "name": "PARENT-REPO", |
| 99 | "owner": {"login": "PARENT-OWNER"}, |
| 100 | "sshUrl": "org-5678@github.com:PARENT-OWNER/PARENT-REPO.git", |
| 101 | "hasIssuesEnabled": true, |
| 102 | "description": "parent repo", |
| 103 | "hasWikiEnabled": true, |
| 104 | "viewerPermission": "READ", |
| 105 | "defaultBranchRef": {"name": "develop"} |
| 106 | }, |
| 107 | "mergeCommitAllowed": false, |
| 108 | "rebaseMergeAllowed": false, |
| 109 | "squashMergeAllowed": true |
| 110 | } } }`)) |
| 111 | |
| 112 | client := newTestClient(httpReg) |
| 113 | repo, err := GitHubRepo(client, ghrepo.New("OWNER", "REPO")) |
| 114 | require.NoError(t, err) |
| 115 | wantParent := &Repository{ |
| 116 | ID: "PARENTID", |
| 117 | Name: "PARENT-REPO", |
| 118 | Owner: RepositoryOwner{Login: "PARENT-OWNER"}, |
| 119 | SSHURL: "org-5678@github.com:PARENT-OWNER/PARENT-REPO.git", |
| 120 | HasIssuesEnabled: true, |
| 121 | Description: "parent repo", |
| 122 | HasWikiEnabled: true, |
| 123 | ViewerPermission: "READ", |
| 124 | DefaultBranchRef: BranchRef{Name: "develop"}, |
| 125 | hostname: "github.com", |
| 126 | } |
| 127 | assert.Equal(t, &Repository{ |
| 128 | ID: "REPOID", |
| 129 | Name: "REPO", |
| 130 | Owner: RepositoryOwner{Login: "OWNER"}, |
| 131 | SSHURL: "git@github.com:OWNER/REPO.git", |
| 132 | HasIssuesEnabled: true, |
| 133 | ViewerPermission: "READ", |
| 134 | DefaultBranchRef: BranchRef{Name: "main"}, |
| 135 | Parent: wantParent, |
| 136 | SquashMergeAllowed: true, |
nothing calls this directly
no test coverage detected