(t *testing.T)
| 109 | } |
| 110 | |
| 111 | func TestRunCreateItem_Draft_User(t *testing.T) { |
| 112 | defer gock.Off() |
| 113 | gock.Observe(gock.DumpRequest) |
| 114 | // get user ID |
| 115 | gock.New("https://api.github.com"). |
| 116 | Post("/graphql"). |
| 117 | MatchType("json"). |
| 118 | JSON(map[string]interface{}{ |
| 119 | "query": "query UserOrgOwner.*", |
| 120 | "variables": map[string]interface{}{ |
| 121 | "login": "monalisa", |
| 122 | }, |
| 123 | }). |
| 124 | Reply(200). |
| 125 | JSON(map[string]interface{}{ |
| 126 | "data": map[string]interface{}{ |
| 127 | "user": map[string]interface{}{ |
| 128 | "id": "an ID", |
| 129 | }, |
| 130 | }, |
| 131 | "errors": []interface{}{ |
| 132 | map[string]interface{}{ |
| 133 | "type": "NOT_FOUND", |
| 134 | "path": []string{"organization"}, |
| 135 | }, |
| 136 | }, |
| 137 | }) |
| 138 | |
| 139 | // get project ID |
| 140 | gock.New("https://api.github.com"). |
| 141 | Post("/graphql"). |
| 142 | MatchType("json"). |
| 143 | JSON(map[string]interface{}{ |
| 144 | "query": "query UserProject.*", |
| 145 | "variables": map[string]interface{}{ |
| 146 | "login": "monalisa", |
| 147 | "number": 1, |
| 148 | "firstItems": 0, |
| 149 | "afterItems": nil, |
| 150 | "firstFields": 0, |
| 151 | "afterFields": nil, |
| 152 | }, |
| 153 | }). |
| 154 | Reply(200). |
| 155 | JSON(map[string]interface{}{ |
| 156 | "data": map[string]interface{}{ |
| 157 | "user": map[string]interface{}{ |
| 158 | "projectV2": map[string]interface{}{ |
| 159 | "id": "an ID", |
| 160 | }, |
| 161 | }, |
| 162 | }, |
| 163 | }) |
| 164 | |
| 165 | // create item |
| 166 | gock.New("https://api.github.com"). |
| 167 | Post("/graphql"). |
| 168 | BodyString(`{"query":"mutation CreateDraftItem.*","variables":{"input":{"projectId":"an ID","title":"a title","body":""}}}`). |
nothing calls this directly
no test coverage detected