(t *testing.T)
| 31 | } |
| 32 | |
| 33 | func TestGitHubRepo_success(t *testing.T) { |
| 34 | httpReg := &httpmock.Registry{} |
| 35 | defer httpReg.Verify(t) |
| 36 | |
| 37 | httpReg.Register( |
| 38 | httpmock.GraphQL(`query RepositoryInfo\b`), |
| 39 | httpmock.StringResponse(` |
| 40 | { "data": { "repository": { |
| 41 | "id": "REPOID", |
| 42 | "name": "REPO", |
| 43 | "owner": {"login": "OWNER"}, |
| 44 | "hasIssuesEnabled": true, |
| 45 | "description": "a cool repo", |
| 46 | "hasWikiEnabled": true, |
| 47 | "viewerPermission": "ADMIN", |
| 48 | "defaultBranchRef": {"name": "main"}, |
| 49 | "parent": null, |
| 50 | "mergeCommitAllowed": true, |
| 51 | "rebaseMergeAllowed": true, |
| 52 | "squashMergeAllowed": false |
| 53 | } } }`)) |
| 54 | |
| 55 | client := newTestClient(httpReg) |
| 56 | repo, err := GitHubRepo(client, ghrepo.New("OWNER", "REPO")) |
| 57 | require.NoError(t, err) |
| 58 | assert.Equal(t, &Repository{ |
| 59 | ID: "REPOID", |
| 60 | Name: "REPO", |
| 61 | Owner: RepositoryOwner{Login: "OWNER"}, |
| 62 | HasIssuesEnabled: true, |
| 63 | Description: "a cool repo", |
| 64 | HasWikiEnabled: true, |
| 65 | ViewerPermission: "ADMIN", |
| 66 | DefaultBranchRef: BranchRef{Name: "main"}, |
| 67 | MergeCommitAllowed: true, |
| 68 | RebaseMergeAllowed: true, |
| 69 | hostname: "github.com", |
| 70 | }, repo) |
| 71 | assert.True(t, repo.ViewerCanPush()) |
| 72 | assert.True(t, repo.ViewerCanTriage()) |
| 73 | } |
| 74 | |
| 75 | func TestGitHubRepo_withParent(t *testing.T) { |
| 76 | httpReg := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected