-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathxray-service.js
33 lines (28 loc) · 861 Bytes
/
xray-service.js
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
const popsicle = require('popsicle');
const auth = require('popsicle-basic-auth');
const XrayService = (options) => {
this.createExecution = (body, callback) => {
popsicle.request({
method: 'POST',
url: options.xrayUrl,
body,
headers: {
'Content-Type': 'application/json'
}
})
.use(auth(options.jiraUser, options.jiraPassword))
.then((res) => {
if (res.status !== 200) {
throw new Error(res.body);
} else {
console.log('Pushed test execution to X-Ray');
callback();
}
})
.catch((error) => {
throw new Error(error);
});
};
return this;
};
module.exports = XrayService;