@@ -122,22 +122,6 @@ func TestPipelineGet_flags(t *testing.T) {
122
122
}
123
123
}
124
124
125
- func TestPipelineGet_malformed (t * testing.T ) {
126
- ts := testGatePipelineTemplateGetMalformed ()
127
- defer ts .Close ()
128
-
129
- rootCmd , rootOpts := cmd .NewCmdRoot (ioutil .Discard , ioutil .Discard )
130
- rootCmd .AddCommand (NewPipelineTemplateCmd (rootOpts ))
131
-
132
- args := []string {"pipeline-template" , "get" , "--id" , "newSpelTemplate" , "--gate-endpoint" , ts .URL }
133
- rootCmd .SetArgs (args )
134
-
135
- err := rootCmd .Execute ()
136
- if err == nil {
137
- t .Fatalf ("Command failed with: %s" , err )
138
- }
139
- }
140
-
141
125
func TestPipelineGet_fail (t * testing.T ) {
142
126
ts := testGateFail ()
143
127
defer ts .Close ()
@@ -175,20 +159,12 @@ func TestPipelineGet_notfound(t *testing.T) {
175
159
func testGatePipelineTemplateGetSuccess () * httptest.Server {
176
160
mux := util .TestGateMuxWithVersionHandler ()
177
161
mux .Handle ("/v2/pipelineTemplates/" , http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
162
+ w .Header ().Add ("content-type" , "application/json" )
178
163
fmt .Fprintln (w , strings .TrimSpace (pipelineTemplateGetJson ))
179
164
}))
180
165
return httptest .NewServer (mux )
181
166
}
182
167
183
- // testGatePipelineGetMalformed returns a malformed get response of pipeline configs.
184
- func testGatePipelineTemplateGetMalformed () * httptest.Server {
185
- mux := util .TestGateMuxWithVersionHandler ()
186
- mux .Handle ("/v2/pipelineTemplates/" , http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
187
- fmt .Fprintln (w , strings .TrimSpace (malformedPipelineTemplateGetJson ))
188
- }))
189
- return httptest .NewServer (mux )
190
- }
191
-
192
168
// testGatePipelineGetMissing returns a 404 Not Found for an errant pipeline name|application pair.
193
169
func testGatePipelineTemplateGetMissing () * httptest.Server {
194
170
mux := util .TestGateMuxWithVersionHandler ()
@@ -207,61 +183,6 @@ func testGateFail() *httptest.Server {
207
183
}))
208
184
}
209
185
210
- const malformedPipelineTemplateGetJson = `
211
- "id": "newSpelTemplate",
212
- "lastModifiedBy": "anonymous",
213
- "metadata": {
214
- "description": "A generic application bake and tag pipeline.",
215
- "name": "Default Bake and Tag",
216
-
217
- "scopes": [
218
- "global"
219
- ]
220
- },
221
- "pipeline": {
222
- "description": "",
223
- "keepWaitingPipelines": false,
224
- "lastModifiedBy": "anonymous",
225
- "limitConcurrent": true,
226
- "notifications": [],
227
- "parameterConfig": [],
228
- "stages": [
229
- {
230
- "name": "My Wait Stage",
231
- "refId": "wait1",
232
- "requisiteStageRefIds": [],
233
- "type": "wait",
234
- "waitTime": "${ templateVariables.waitTime }"
235
- }
236
- ],
237
- "triggers": [
238
- {
239
- "attributeConstraints": {},
240
- "enabled": true,
241
- "payloadConstraints": {},
242
- "pubsubSystem": "google",
243
- "source": "jtk54",
244
- "subscription": "super-pub",
245
- "subscriptionName": "super-pub",
246
- "type": "pubsub"
247
- }
248
- ],
249
- "updateTs": "1543509523663"
250
- },
251
- "protect": false,
252
- "schema": "v2",
253
- "updateTs": "1543860678988",
254
- "variables": [
255
- {
256
- "defaultValue": 42,
257
- "description": "The time a wait stage shall pauseth",
258
- "name": "waitTime",
259
- "type": "int"
260
- }
261
- ]
262
- }
263
- `
264
-
265
186
const pipelineTemplateGetJson = `
266
187
{
267
188
"id": "newSpelTemplate",
0 commit comments