Skip to content

Commit eccc8c3

Browse files
Gianfranco97ajsb85
authored andcommitted
test: update dependencies and tests
1 parent b101fc5 commit eccc8c3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1883
-1980
lines changed

.eslintrc.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
module.exports = {
2-
"extends": "standard",
2+
"extends": "airbnb-base",
33
"rules": {
4-
"indent": ["error", 4],
5-
"camelcase": 0
4+
"semi": ["error", "never"]
65
},
76
"env": {
87
"mocha": true,
98
"node": true
109
}
11-
};
10+
}

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ install:
1010
script:
1111
- yarn build
1212
- ci/create-config-file.sh
13+
- yarn lint
1314
- yarn test

bin/glpi-api

Lines changed: 0 additions & 18 deletions
This file was deleted.

examples/async-await/addItem.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,20 @@
2222
* @link http://www.glpi-project.org/
2323
* -------------------------------------------------------------------- */
2424

25+
/* eslint no-console: 0 */
26+
2527
const GlpiRestClient = require('../../lib/GlpiRestClient').default
2628
const config = require('../../config.json')
27-
const itemtype = require('../../lib/GlpiRestClient').itemtype;
29+
const { itemtype } = require('../../lib/GlpiRestClient');
2830

2931
(async () => {
30-
try {
31-
const client = new GlpiRestClient(config.apirest)
32-
await client.initSessionByCredentials(config.user.name, config.user.password, config.appToken)
33-
const NewItem = await client.addItem(itemtype.UserEmail, [{users_id: 40, email: '[email protected]'}, {users_id: 40, email: '[email protected]'}])
34-
console.log(NewItem)
35-
await client.killSession()
36-
} catch (err) {
37-
console.log(err)
38-
}
32+
try {
33+
const client = new GlpiRestClient(config.apirest)
34+
await client.initSessionByCredentials(config.user.name, config.user.password, config.appToken)
35+
const NewItem = await client.addItem(itemtype.UserEmail, [{ users_id: 40, email: '[email protected]' }, { users_id: 40, email: '[email protected]' }])
36+
console.log(NewItem)
37+
await client.killSession()
38+
} catch (err) {
39+
console.log(err)
40+
}
3941
})()

examples/async-await/changeActiveEntities.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,19 @@
2222
* @link http://www.glpi-project.org/
2323
* -------------------------------------------------------------------- */
2424

25+
/* eslint no-console: 0 */
26+
2527
const GlpiRestClient = require('../../lib/GlpiRestClient').default
2628
const config = require('../../config.json');
2729

2830
(async () => {
29-
try {
30-
const client = new GlpiRestClient(config.apirest)
31-
await client.initSessionByCredentials(config.user.name, config.user.password, config.appToken)
32-
const ChangeActiveEntities = await client.changeActiveEntities(null, true)
33-
console.log(ChangeActiveEntities)
34-
await client.killSession()
35-
} catch (err) {
36-
console.log(err)
37-
}
31+
try {
32+
const client = new GlpiRestClient(config.apirest)
33+
await client.initSessionByCredentials(config.user.name, config.user.password, config.appToken)
34+
const ChangeActiveEntities = await client.changeActiveEntities(null, true)
35+
console.log(ChangeActiveEntities)
36+
await client.killSession()
37+
} catch (err) {
38+
console.log(err)
39+
}
3840
})()

examples/async-await/changeActiveProfile.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,20 @@
2222
* @link http://www.glpi-project.org/
2323
* -------------------------------------------------------------------- */
2424

25+
/* eslint no-console: 0 */
26+
2527
const GlpiRestClient = require('../../lib/GlpiRestClient').default
2628
const config = require('../../config.json');
2729

2830
(async () => {
29-
try {
30-
const client = new GlpiRestClient(config.apirest)
31-
await client.initSessionByCredentials(config.user.name, config.user.password, config.appToken)
32-
const MyProfiles = await client.getMyProfiles()
33-
const ChangeActiveProfile = await client.changeActiveProfile(MyProfiles.data[0].id)
34-
console.log(ChangeActiveProfile)
35-
await client.killSession()
36-
} catch (err) {
37-
console.log(err)
38-
}
31+
try {
32+
const client = new GlpiRestClient(config.apirest)
33+
await client.initSessionByCredentials(config.user.name, config.user.password, config.appToken)
34+
const MyProfiles = await client.getMyProfiles()
35+
const ChangeActiveProfile = await client.changeActiveProfile(MyProfiles.data[0].id)
36+
console.log(ChangeActiveProfile)
37+
await client.killSession()
38+
} catch (err) {
39+
console.log(err)
40+
}
3941
})()

examples/async-await/deleteItem.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,20 @@
2222
* @link http://www.glpi-project.org/
2323
* -------------------------------------------------------------------- */
2424

25+
/* eslint no-console: 0 */
26+
2527
const GlpiRestClient = require('../../lib/GlpiRestClient').default
2628
const config = require('../../config.json')
27-
const itemtype = require('../../lib/GlpiRestClient').itemtype;
29+
const { itemtype } = require('../../lib/GlpiRestClient');
2830

2931
(async () => {
30-
try {
31-
const client = new GlpiRestClient(config.apirest)
32-
await client.initSessionByCredentials(config.user.name, config.user.password, config.appToken)
33-
const ItemDelete = await client.deleteItem(itemtype.UserEmail, null, [{id: 167}, {id: 168}])
34-
console.log(ItemDelete)
35-
await client.killSession()
36-
} catch (err) {
37-
console.log(err)
38-
}
32+
try {
33+
const client = new GlpiRestClient(config.apirest)
34+
await client.initSessionByCredentials(config.user.name, config.user.password, config.appToken)
35+
const ItemDelete = await client.deleteItem(itemtype.UserEmail, null, [{ id: 167 }, { id: 168 }])
36+
console.log(ItemDelete)
37+
await client.killSession()
38+
} catch (err) {
39+
console.log(err)
40+
}
3941
})()

examples/async-await/getActiveEntities.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,19 @@
2222
* @link http://www.glpi-project.org/
2323
* -------------------------------------------------------------------- */
2424

25+
/* eslint no-console: 0 */
26+
2527
const GlpiRestClient = require('../../lib/GlpiRestClient').default
2628
const config = require('../../config.json');
2729

2830
(async () => {
29-
try {
30-
const client = new GlpiRestClient(config.apirest)
31-
await client.initSessionByCredentials(config.user.name, config.user.password, config.appToken)
32-
const ActiveEntities = await client.getActiveEntities()
33-
console.log(ActiveEntities)
34-
await client.killSession()
35-
} catch (err) {
36-
console.log(err)
37-
}
31+
try {
32+
const client = new GlpiRestClient(config.apirest)
33+
await client.initSessionByCredentials(config.user.name, config.user.password, config.appToken)
34+
const ActiveEntities = await client.getActiveEntities()
35+
console.log(ActiveEntities)
36+
await client.killSession()
37+
} catch (err) {
38+
console.log(err)
39+
}
3840
})()

examples/async-await/getActiveProfile.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,19 @@
2222
* @link http://www.glpi-project.org/
2323
* -------------------------------------------------------------------- */
2424

25+
/* eslint no-console: 0 */
26+
2527
const GlpiRestClient = require('../../lib/GlpiRestClient').default
2628
const config = require('../../config.json');
2729

2830
(async () => {
29-
try {
30-
const client = new GlpiRestClient(config.apirest)
31-
await client.initSessionByCredentials(config.user.name, config.user.password, config.appToken)
32-
const ActiveProfile = await client.getActiveProfile()
33-
console.log(ActiveProfile)
34-
await client.killSession()
35-
} catch (err) {
36-
console.log(err)
37-
}
31+
try {
32+
const client = new GlpiRestClient(config.apirest)
33+
await client.initSessionByCredentials(config.user.name, config.user.password, config.appToken)
34+
const ActiveProfile = await client.getActiveProfile()
35+
console.log(ActiveProfile)
36+
await client.killSession()
37+
} catch (err) {
38+
console.log(err)
39+
}
3840
})()

examples/async-await/getAllItems.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,20 @@
2222
* @link http://www.glpi-project.org/
2323
* -------------------------------------------------------------------- */
2424

25+
/* eslint no-console: 0 */
26+
2527
const GlpiRestClient = require('../../lib/GlpiRestClient').default
2628
const config = require('../../config.json')
27-
const itemtype = require('../../lib/GlpiRestClient').itemtype;
29+
const { itemtype } = require('../../lib/GlpiRestClient');
2830

2931
(async () => {
30-
try {
31-
const client = new GlpiRestClient(config.apirest)
32-
await client.initSessionByCredentials(config.user.name, config.user.password, config.appToken)
33-
const AllItems = await client.getAllItems(itemtype.UserEmail)
34-
console.log(AllItems)
35-
await client.killSession()
36-
} catch (err) {
37-
console.log(err)
38-
}
32+
try {
33+
const client = new GlpiRestClient(config.apirest)
34+
await client.initSessionByCredentials(config.user.name, config.user.password, config.appToken)
35+
const AllItems = await client.getAllItems(itemtype.UserEmail)
36+
console.log(AllItems)
37+
await client.killSession()
38+
} catch (err) {
39+
console.log(err)
40+
}
3941
})()

0 commit comments

Comments
 (0)