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