(t *testing.T)
| 90 | } |
| 91 | |
| 92 | func TestRunMarkTemplate_Org(t *testing.T) { |
| 93 | defer gock.Off() |
| 94 | gock.Observe(gock.DumpRequest) |
| 95 | |
| 96 | // get org ID |
| 97 | gock.New("https://api.github.com"). |
| 98 | Post("/graphql"). |
| 99 | MatchType("json"). |
| 100 | JSON(map[string]interface{}{ |
| 101 | "query": "query UserOrgOwner.*", |
| 102 | "variables": map[string]interface{}{ |
| 103 | "login": "github", |
| 104 | }, |
| 105 | }). |
| 106 | Reply(200). |
| 107 | JSON(map[string]interface{}{ |
| 108 | "data": map[string]interface{}{ |
| 109 | "organization": map[string]interface{}{ |
| 110 | "id": "an ID", |
| 111 | }, |
| 112 | }, |
| 113 | "errors": []interface{}{ |
| 114 | map[string]interface{}{ |
| 115 | "type": "NOT_FOUND", |
| 116 | "path": []string{"user"}, |
| 117 | }, |
| 118 | }, |
| 119 | }) |
| 120 | |
| 121 | // get project ID |
| 122 | gock.New("https://api.github.com"). |
| 123 | Post("/graphql"). |
| 124 | MatchType("json"). |
| 125 | JSON(map[string]interface{}{ |
| 126 | "query": "query OrgProject.*", |
| 127 | "variables": map[string]interface{}{ |
| 128 | "login": "github", |
| 129 | "number": 1, |
| 130 | "firstItems": 0, |
| 131 | "afterItems": nil, |
| 132 | "firstFields": 0, |
| 133 | "afterFields": nil, |
| 134 | }, |
| 135 | }). |
| 136 | Reply(200). |
| 137 | JSON(map[string]interface{}{ |
| 138 | "data": map[string]interface{}{ |
| 139 | "organization": map[string]interface{}{ |
| 140 | "projectV2": map[string]interface{}{ |
| 141 | "id": "an ID", |
| 142 | }, |
| 143 | }, |
| 144 | }, |
| 145 | }) |
| 146 | |
| 147 | // template project |
| 148 | gock.New("https://api.github.com"). |
| 149 | Post("/graphql"). |
nothing calls this directly
no test coverage detected