-
Notifications
You must be signed in to change notification settings - Fork 582
/
mockingUtils.go
586 lines (515 loc) · 20.6 KB
/
mockingUtils.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
//go:build !release
// +build !release
package cpi
import (
"bytes"
"io"
"net/http"
"strings"
"github.com/pkg/errors"
)
// GetCPIFunctionMockResponse -Generate mock response payload for different CPI functions
func GetCPIFunctionMockResponse(functionName, testType string) (*http.Response, error) {
switch functionName {
case "IntegrationArtifactDeploy", "PositiveAndUnDeployIntegrationDesigntimeArtifact":
return GetEmptyHTTPResponseBodyAndErrorNil()
case "FailIntegrationDesigntimeArtifactDeployment", "FailedIntegrationRuntimeArtifactUnDeployment":
return GetNegativeCaseHTTPResponseBodyAndErrorNil()
case "IntegrationArtifactUpdateConfiguration":
if testType == "Positive" {
return GetEmptyHTTPResponseBodyAndErrorNil()
}
if testType == "Negative_With_ResponseBody" {
return GetNegativeCaseHTTPResponseBodyAndErrorNil()
}
return GetParameterKeyMissingResponseBody()
case "IntegrationArtifactGetMplStatus", "APIKeyValueMapDownload", "APIProviderDownload":
return GetIntegrationArtifactGetMplStatusCommandMockResponse(testType)
case "IntegrationArtifactGetServiceEndpoint":
return GetIntegrationArtifactGetServiceEndpointCommandMockResponse(testType)
case "IntegrationArtifactDownload", "APIProxyDownload":
return IntegrationArtifactDownloadCommandMockResponse(testType)
case "GetIntegrationDesigntimeArtifact":
return GetIntegrationDesigntimeArtifactMockResponse(testType)
case "UploadIntegrationDesigntimeArtifact":
return GetIntegrationDesigntimeArtifactMockResponse(testType)
case "UploadIntegrationDesigntimeArtifactNegative":
return GetRespBodyHTTPStatusServiceErrorResponse()
case "UpdateIntegrationDesigntimeArtifactNegative":
return GetRespBodyHTTPStatusServiceErrorResponse()
case "UpdateIntegrationDesigntimeArtifact":
return UpdateIntegrationDesigntimeArtifactMockResponse(testType)
case "IntegrationDesigntimeArtifactUpdate":
return IntegrationDesigntimeArtifactUpdateMockResponse(testType)
case "GetIntegrationArtifactDeployStatus":
return GetIntegrationArtifactDeployStatusMockResponse(testType)
case "GetIntegrationArtifactDeployErrorDetails":
return GetIntegrationArtifactDeployErrorDetailsMockResponse(testType)
case "TriggerIntegrationTest":
return TriggerIntegrationTestMockResponse(testType)
case "IntegrationArtifactGetMplStatusError":
return GetIntegrationArtifactDeployErrorStatusMockResponseBody()
case "IntegrationArtifactResourceCreate", "ApiKeyValueMapUpload":
if testType == "Negative" {
return GetRespBodyHTTPStatusServiceErrorResponse()
}
if testType == "HttpResponseNotAccepted" {
return GetEmptyHTTPResponseBodyAndErrorNil()
}
if testType == "NilHttpResponse" {
return nil, errors.New("invalid payalod")
}
return GetRespBodyHTTPStatusCreated()
case "IntegrationArtifactResourceUpdate", "IntegrationArtifactResourceDelete", "ApiProxyUpload":
return GetRespBodyHTTPStatusOK()
default:
res := http.Response{
StatusCode: 404,
Body: io.NopCloser(bytes.NewReader([]byte(``))),
}
return &res, errors.New("Service not Found")
}
}
// GetEmptyHTTPResponseBodyAndErrorNil -Empty http respose body
func GetEmptyHTTPResponseBodyAndErrorNil() (*http.Response, error) {
res := http.Response{
StatusCode: 202,
Body: io.NopCloser(bytes.NewReader([]byte(``))),
}
return &res, nil
}
// GetParameterKeyMissingResponseBody -Parameter key missing http respose body
func GetParameterKeyMissingResponseBody() (*http.Response, error) {
res := http.Response{
StatusCode: 404,
Body: io.NopCloser(bytes.NewReader([]byte(`{
"code": "Not Found",
"message": {
"@lang": "en",
"#text": "Parameter key 'Parameter1' not found."
}
}`))),
}
return &res, errors.New("Not found - either wrong version for the given Id or wrong parameter key")
}
// GetNegativeCaseHTTPResponseBodyAndErrorNil -Negative case http respose body
func GetNegativeCaseHTTPResponseBodyAndErrorNil() (*http.Response, error) {
res := http.Response{
StatusCode: 400,
Body: io.NopCloser(bytes.NewReader([]byte(`{
"code": "Bad Request",
"message": {
"@lang": "en",
"#text": "Wrong body format for the expected parameter value"
}
}`))),
}
return &res, nil
}
// GetIntegrationArtifactGetMplStatusCommandMockResponse -Provide http respose body
func GetIntegrationArtifactGetMplStatusCommandMockResponse(testType string) (*http.Response, error) {
if testType == "Positive" {
res := http.Response{
StatusCode: 200,
Body: io.NopCloser(bytes.NewReader([]byte(`{
"d": {
"results": [
{
"__metadata": {
"id": "https://roverpoc.it-accd002.cfapps.sap.hana.ondemand.com:443/api/v1/MessageProcessingLogs('AGAS1GcWkfBv-ZtpS6j7TKjReO7t')",
"uri": "https://roverpoc.it-accd002.cfapps.sap.hana.ondemand.com:443/api/v1/MessageProcessingLogs('AGAS1GcWkfBv-ZtpS6j7TKjReO7t')",
"type": "com.sap.hci.api.MessageProcessingLog"
},
"MessageGuid": "AGAS1GcWkfBv-ZtpS6j7TKjReO7t",
"CorrelationId": "AGAS1GevYrPodxieoYf4YSY4jd-8",
"ApplicationMessageId": null,
"ApplicationMessageType": null,
"LogStart": "/Date(1611846759005)/",
"LogEnd": "/Date(1611846759032)/",
"Sender": null,
"Receiver": null,
"IntegrationFlowName": "flow1",
"Status": "COMPLETED",
"LogLevel": "INFO",
"CustomStatus": "COMPLETED",
"TransactionId": "aa220151116748eeae69db3e88f2bbc8"
}
]
}
}`))),
}
return &res, nil
}
res := http.Response{
StatusCode: 400,
Body: io.NopCloser(bytes.NewReader([]byte(`{
"code": "Bad Request",
"message": {
"@lang": "en",
"#text": "Invalid order by expression"
}
}`))),
}
return &res, errors.New("Unable to get integration flow MPL status, Response Status code:400")
}
// GetIntegrationArtifactGetServiceEndpointCommandMockResponse -Provide http respose body
func GetIntegrationArtifactGetServiceEndpointCommandMockResponse(testCaseType string) (*http.Response, error) {
if testCaseType == "PositiveAndGetetIntegrationArtifactGetServiceResBody" {
return GetIntegrationArtifactGetServiceEndpointPositiveCaseRespBody()
}
res := http.Response{
StatusCode: 400,
Body: io.NopCloser(bytes.NewReader([]byte(`{
"code": "Bad Request",
"message": {
"@lang": "en",
"#text": "invalid service endpoint query"
}
}`))),
}
return &res, errors.New("Unable to get integration flow service endpoint, Response Status code:400")
}
// TriggerIntegrationTestMockResponse
func TriggerIntegrationTestMockResponse(testCaseType string) (*http.Response, error) {
if testCaseType == "Positive" {
return &http.Response{
StatusCode: 200,
Body: io.NopCloser(bytes.NewReader([]byte(`{
"code": "Good Request",
"message": {
"@lang": "en",
"#text": "valid"
}
}`))),
Header: map[string][]string{
"test": []string{"this is a test"},
},
}, nil
}
res := http.Response{
StatusCode: 400,
Body: io.NopCloser(bytes.NewReader([]byte(`{
"code": "Bad Request",
"message": {
"@lang": "en",
"#text": "invalid"
}
}`))),
}
return &res, errors.New("Unable to trigger integration test, Response Status code:400")
}
// GetIntegrationArtifactGetServiceEndpointPositiveCaseRespBody -Provide http respose body for positive case
func GetIntegrationArtifactGetServiceEndpointPositiveCaseRespBody() (*http.Response, error) {
resp := http.Response{
StatusCode: 200,
Body: io.NopCloser(bytes.NewReader([]byte(`{
"d": {
"results": [
{
"__metadata": {
"id": "https://demo.cfapps.sap.hana.ondemand.com:443/api/v1/ServiceEndpoints('CPI_IFlow_Call_using_Cert%24endpointAddress%3Dtestwithcert')",
"uri": "https://demo.cfapps.sap.hana.ondemand.com:443/api/v1/ServiceEndpoints('CPI_IFlow_Call_using_Cert%24endpointAddress%3Dtestwithcert')",
"type": "com.sap.hci.api.ServiceEndpoint"
},
"Name": "CPI_IFlow_Call_using_Cert",
"Id": "CPI_IFlow_Call_using_Cert$endpointAddress=testwithcert",
"EntryPoints": {
"results": [
{
"__metadata": {
"id": "https://demo.cfapps.sap.hana.ondemand.com:443/api/v1/EntryPoints('https%3A%2F%2Froverpoc.it-accd002-rt.cfapps.sap.hana.ondemand.com%2Fhttp%2Ftestwithcert')",
"uri": "https://demo.cfapps.sap.hana.ondemand.com:443/api/v1/EntryPoints('https%3A%2F%2Froverpoc.it-accd002-rt.cfapps.sap.hana.ondemand.com%2Fhttp%2Ftestwithcert')",
"type": "com.sap.hci.api.EntryPoint"
},
"Name": "CPI_IFlow_Call_using_Cert",
"Url": "https://demo.cfapps.sap.hana.ondemand.com/http/testwithcert",
"Type": "PROD",
"AdditionalInformation": ""
}
]
}
}
]
}
}`))),
}
return &resp, nil
}
// GetRespBodyHTTPStatusOK -Provide http respose body for Http StatusOK
func GetRespBodyHTTPStatusOK() (*http.Response, error) {
resp := http.Response{
StatusCode: 200,
Body: io.NopCloser(bytes.NewReader([]byte(``))),
}
return &resp, nil
}
// GetRespBodyHTTPStatusCreated -Provide http respose body for Http StatusOK
func GetRespBodyHTTPStatusCreated() (*http.Response, error) {
resp := http.Response{
StatusCode: 201,
Body: io.NopCloser(bytes.NewReader([]byte(``))),
}
return &resp, nil
}
// GetRespBodyHTTPStatusServiceNotFound -Provide http respose body for Http URL not Found
func GetRespBodyHTTPStatusServiceNotFound() (*http.Response, error) {
resp := http.Response{
StatusCode: 404,
Body: io.NopCloser(bytes.NewReader([]byte(``))),
}
return &resp, errors.New("Integration Package not found")
}
// GetRespBodyHTTPStatusServiceErrorResponse -Provide http respose body for server error
func GetRespBodyHTTPStatusServiceErrorResponse() (*http.Response, error) {
resp := http.Response{
StatusCode: 500,
Body: io.NopCloser(bytes.NewReader([]byte(``))),
}
return &resp, errors.New("401 Unauthorized")
}
// IntegrationArtifactDownloadCommandMockResponse -Provide http respose body
func IntegrationArtifactDownloadCommandMockResponse(testType string) (*http.Response, error) {
return GetMockResponseByTestTypeAndMockFunctionName("IntegrationArtifactDownloadCommandMockResponse", testType)
}
// GetIntegrationDesigntimeArtifactMockResponse -Provide http respose body
func GetIntegrationDesigntimeArtifactMockResponse(testType string) (*http.Response, error) {
return GetMockResponseByTestTypeAndMockFunctionName("GetIntegrationDesigntimeArtifactMockResponse", testType)
}
// IntegrationDesigntimeArtifactUpdateMockResponse -Provide http respose body
func IntegrationDesigntimeArtifactUpdateMockResponse(testType string) (*http.Response, error) {
return GetMockResponseByTestTypeAndMockFunctionName("IntegrationDesigntimeArtifactUpdateMockResponse", testType)
}
// GetMockResponseByTestTypeAndMockFunctionName - Get mock response by testtype and mock function name
func GetMockResponseByTestTypeAndMockFunctionName(mockFuntionName, testType string) (*http.Response, error) {
response, error := GetPositiveCaseResponseByTestType(testType)
if response == nil && error == nil {
switch mockFuntionName {
case "IntegrationDesigntimeArtifactUpdateMockResponse":
return NegtiveResForIntegrationArtifactGenericCommandMockResponse("Unable to get status of integration artifact, Response Status code:400")
case "GetIntegrationDesigntimeArtifactMockResponse":
return NegtiveResForIntegrationArtifactGenericCommandMockResponse("Unable to get status of integration artifact, Response Status code:400")
case "IntegrationArtifactDownloadCommandMockResponse":
return NegtiveResForIntegrationArtifactGenericCommandMockResponse("Unable to download integration artifact, Response Status code:400")
case "GetIntegrationArtifactDeployStatusMockResponse":
res := http.Response{
StatusCode: 400,
Body: io.NopCloser(bytes.NewReader([]byte(`{
"code": "Bad Request",
"message": {
"@lang": "en",
"#text": "Bad request"
}
}`))),
}
return &res, errors.New("Unable to get integration artifact deploy status, Response Status code:400")
case "GetIntegrationArtifactDeployErrorDetailsMockResponse":
res := http.Response{
StatusCode: 500,
Body: io.NopCloser(bytes.NewReader([]byte(`{
"code": "Internal Server Error",
"message": {
"@lang": "en",
"#text": "Internal Processing Error"
}
}`))),
}
return &res, errors.New("Unable to get integration artifact deploy error status, Response Status code:400")
}
}
return response, error
}
// NegtiveResForIntegrationArtifactGenericCommandMockResponse -Nagative Case http response body
func NegtiveResForIntegrationArtifactGenericCommandMockResponse(message string) (*http.Response, error) {
res := http.Response{
StatusCode: 400,
Body: io.NopCloser(bytes.NewReader([]byte(`{
"code": "Bad Request",
"message": {
"@lang": "en",
"#text": "invalid request"
}
}`))),
}
return &res, errors.New(message)
}
// UpdateIntegrationDesigntimeArtifactMockResponse -Provide http respose body
func UpdateIntegrationDesigntimeArtifactMockResponse(testType string) (*http.Response, error) {
response, error := GetRespBodyHTTPStatusCreated()
if response == nil && error == nil {
res := http.Response{
StatusCode: 400,
Body: io.NopCloser(bytes.NewReader([]byte(`{
"code": "Bad Request",
"message": {
"@lang": "en",
"#text": "invalid request"
}
}`))),
}
return &res, errors.New("Unable to get status of integration artifact, Response Status code:400")
}
return response, error
}
// IntegrationArtifactDownloadCommandMockResponsePositiveCaseRespBody -Provide http respose body for positive case
func IntegrationArtifactDownloadCommandMockResponsePositiveCaseRespBody() (*http.Response, error) {
header := make(http.Header)
headerValue := "attachment; filename=flow1.zip"
header.Add("Content-Disposition", headerValue)
resp := http.Response{
StatusCode: 200,
Header: header,
Body: io.NopCloser(bytes.NewReader([]byte(`UEsDBBQACAgIADQ2clAAAAAAAAAAAAAAAAAUAAQATU`))),
}
return &resp, nil
}
// GetPositiveCaseResponseByTestType - get postive response by test case type
func GetPositiveCaseResponseByTestType(testType string) (*http.Response, error) {
switch testType {
case "PositiveAndGetetIntegrationArtifactDownloadResBody":
return IntegrationArtifactDownloadCommandMockResponsePositiveCaseRespBody()
case "PositiveAndCreateIntegrationDesigntimeArtifactResBody":
return GetRespBodyHTTPStatusOK()
case "NegativeAndCreateIntegrationDesigntimeArtifactResBody":
return GetRespBodyHTTPStatusOK()
case "PositiveAndUpdateIntegrationDesigntimeArtifactResBody":
return GetRespBodyHTTPStatusServiceNotFound()
case "NegativeAndUpdateIntegrationDesigntimeArtifactResBody":
return GetRespBodyHTTPStatusServiceNotFound()
case "PositiveAndDeployIntegrationDesigntimeArtifactResBody":
return GetIntegrationArtifactDeployStatusMockResponseBody()
case "PositiveAndGetDeployedIntegrationDesigntimeArtifactErrorResBody":
return GetIntegrationArtifactDeployErrorStatusMockResponseBody()
case "NegativeAndDeployIntegrationDesigntimeArtifactResBody":
return GetIntegrationArtifactDeployStatusErrorMockResponseBody()
default:
return nil, nil
}
}
// GetCPIFunctionNameByURLCheck - get postive response by test case type
func GetCPIFunctionNameByURLCheck(url, method, testType string) string {
switch url {
case "https://demo/api/v1/IntegrationDesigntimeArtifacts(Id='flow4',Version='1.0.4')":
return GetFunctionNameByTestTypeAndMethod(method, testType)
case "https://demo/api/v1/IntegrationDesigntimeArtifacts(Id='flow4',Version='Active')":
return GetFunctionNameByTestTypeAndMethod(method, testType)
case "https://demo/api/v1/IntegrationDesigntimeArtifacts":
return GetFunctionNameByTestTypeAndMethod(method, testType)
case "https://demo/api/v1/DeployIntegrationDesigntimeArtifact?Id='flow1'&Version='Active'":
return GetFunctionNameByTestTypeAndMethod(method, testType)
case "https://demo/api/v1/BuildAndDeployStatus(TaskId='')":
return "GetIntegrationArtifactDeployStatus"
case "https://demo/api/v1/IntegrationRuntimeArtifacts('flow1')/ErrorInformation/$value":
return "GetIntegrationArtifactDeployErrorDetails"
default:
return ""
}
}
// GetFunctionNameByTestTypeAndMethod -get function name by test tyep
func GetFunctionNameByTestTypeAndMethod(method, testType string) string {
switch testType {
case "PositiveAndCreateIntegrationDesigntimeArtifactResBody":
return GetFunctionNamePositiveAndCreateIntegrationDesigntimeArtifactResBody(method)
case "PositiveAndUpdateIntegrationDesigntimeArtifactResBody":
return GetFunctionNamePositiveAndUpdateIntegrationDesigntimeArtifactResBody(method)
case "NegativeAndGetIntegrationDesigntimeArtifactResBody":
if method == "GET" {
return "GetIntegrationDesigntimeArtifact"
}
case "NegativeAndCreateIntegrationDesigntimeArtifactResBody":
if method == "GET" {
return "GetIntegrationDesigntimeArtifact"
}
if method == "PUT" {
return "UploadIntegrationDesigntimeArtifactNegative"
}
case "NegativeAndUpdateIntegrationDesigntimeArtifactResBody":
if method == "GET" {
return "GetIntegrationDesigntimeArtifact"
}
if method == "POST" {
return "UpdateIntegrationDesigntimeArtifactNegative"
}
case "PositiveAndDeployIntegrationDesigntimeArtifactResBody", "NegativeAndDeployIntegrationDesigntimeArtifactResBody":
if method == "POST" {
return "IntegrationArtifactDeploy"
}
default:
return ""
}
return ""
}
// GetFunctionNamePositiveAndUpdateIntegrationDesigntimeArtifactResBody -Get Function Name
func GetFunctionNamePositiveAndUpdateIntegrationDesigntimeArtifactResBody(method string) string {
if method == "GET" {
return "IntegrationDesigntimeArtifactUpdate"
}
if method == "POST" {
return "UpdateIntegrationDesigntimeArtifact"
}
return ""
}
// GetFunctionNamePositiveAndCreateIntegrationDesigntimeArtifactResBody -Get Function Name
func GetFunctionNamePositiveAndCreateIntegrationDesigntimeArtifactResBody(method string) string {
if method == "GET" {
return "GetIntegrationDesigntimeArtifact"
}
if method == "PUT" {
return "UploadIntegrationDesigntimeArtifact"
}
return ""
}
// GetIntegrationArtifactDeployStatusMockResponse -Provide http respose body
func GetIntegrationArtifactDeployStatusMockResponse(testType string) (*http.Response, error) {
return GetMockResponseByTestTypeAndMockFunctionName("GetIntegrationArtifactDeployStatusMockResponse", testType)
}
// GetIntegrationArtifactDeployErrorDetailsMockResponse -Provide http respose body
func GetIntegrationArtifactDeployErrorDetailsMockResponse(testType string) (*http.Response, error) {
return GetMockResponseByTestTypeAndMockFunctionName("GetIntegrationArtifactDeployErrorDetailsMockResponse", "PositiveAndGetDeployedIntegrationDesigntimeArtifactErrorResBody")
}
// GetIntegrationArtifactDeployStatusMockResponseBody -Provide http respose body
func GetIntegrationArtifactDeployStatusMockResponseBody() (*http.Response, error) {
resp := http.Response{
StatusCode: 200,
Body: io.NopCloser(bytes.NewReader([]byte(GetIntegrationArtifactDeployStatusPayload("STARTED")))),
}
return &resp, nil
}
// GetIntegrationArtifactDeployStatusErrorMockResponseBody -Provide http respose body
func GetIntegrationArtifactDeployStatusErrorMockResponseBody() (*http.Response, error) {
resp := http.Response{
StatusCode: 200,
Body: io.NopCloser(bytes.NewReader([]byte(GetIntegrationArtifactDeployStatusPayload("FAIL")))),
}
return &resp, nil
}
// GetIntegrationArtifactDeployStatusPayload -Get Payload
func GetIntegrationArtifactDeployStatusPayload(status string) string {
jsonByte := []byte(`{
"d": {
"__metadata": {
"id": "https://roverpoc.it-accd002.cfapps.sap.hana.ondemand.com/api/v1/IntegrationRuntimeArtifacts('smtp')",
"uri": "https://roverpoc.it-accd002.cfapps.sap.hana.ondemand.com/api/v1/IntegrationRuntimeArtifacts('smtp')",
"media_src": "https://roverpoc.it-accd002.cfapps.sap.hana.ondemand.com/api/v1/IntegrationRuntimeArtifacts('smtp')/$value",
"edit_media": "https://roverpoc.it-accd002.cfapps.sap.hana.ondemand.com/api/v1/IntegrationRuntimeArtifacts('smtp')/$value"
},
"Id": "smtp",
"Version": "2.0",
"Name": "smtp",
"Status": "StatusValue",
"ErrorInformation": {
"__deferred": {
"uri": "https://roverpoc.it-accd002.cfapps.sap.hana.ondemand.com/api/v1/IntegrationRuntimeArtifacts('smtp')/ErrorInformation"
}
}
}
}`)
return strings.Replace(string(jsonByte), "StatusValue", status, 1)
}
// GetIntegrationArtifactDeployErrorStatusMockResponseBody -Provide http respose body
func GetIntegrationArtifactDeployErrorStatusMockResponseBody() (*http.Response, error) {
resp := http.Response{
StatusCode: 200,
Body: io.NopCloser(bytes.NewReader([]byte(`{"message": "java.lang.IllegalStateException: No credentials for 'smtp' found"}`))),
}
return &resp, nil
}