mongodb-atlas-api-client 3.21.0 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/npmpublish.yml +1 -1
- package/.github/workflows/pull_request.yml +20 -0
- package/.github/workflows/testcoverage.yml +1 -1
- package/eslint.config.js +251 -0
- package/package.json +8 -8
- package/test/alert.test.js +39 -20
- package/test/atlasSearch.test.js +56 -38
- package/test/atlasUser.test.js +47 -25
- package/test/cloudProviderAccess.test.js +42 -17
- package/test/cloudbackup.test.js +41 -17
- package/test/cluster.test.js +64 -29
- package/test/customDbRole.test.js +47 -20
- package/test/dataLake.test.js +54 -24
- package/test/event.test.js +40 -17
- package/test/helper.test.js +2 -2
- package/test/organization.test.js +58 -27
- package/test/project.test.js +62 -29
- package/test/projectAccesslist.test.js +47 -20
- package/test/projectWhitelist.test.js +47 -20
- package/test/user.test.js +47 -20
- package/.eslintrc +0 -254
package/test/dataLake.test.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
const {describe, it} = exports.lab = require("@hapi/lab").script();
|
|
2
|
-
const {expect} = require(
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
1
|
+
const {describe, it, afterEach, before, beforeEach} = exports.lab = require("@hapi/lab").script();
|
|
2
|
+
const {expect} = require('@hapi/code');
|
|
3
|
+
const getClient = require('../src/index.js');
|
|
4
|
+
const {MockAgent, setGlobalDispatcher} = require('urllib');
|
|
5
|
+
|
|
6
|
+
const baseUrl = "http://localhost:7001";
|
|
6
7
|
const projectId = "dummyProjectId";
|
|
7
8
|
|
|
8
9
|
const client = getClient({
|
|
@@ -14,6 +15,21 @@ const client = getClient({
|
|
|
14
15
|
|
|
15
16
|
describe("Mongo Atlas Api Client - dataLake", () => {
|
|
16
17
|
|
|
18
|
+
let mockAgent;
|
|
19
|
+
let mockPool;
|
|
20
|
+
before(() => {
|
|
21
|
+
mockAgent = new MockAgent();
|
|
22
|
+
setGlobalDispatcher(mockAgent);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
mockPool = mockAgent.get(baseUrl);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
afterEach(() => {
|
|
30
|
+
mockAgent.assertNoPendingInterceptors();
|
|
31
|
+
});
|
|
32
|
+
|
|
17
33
|
describe("When dataLake is exported from index", () => {
|
|
18
34
|
it("should export dataLake functions", async () => {
|
|
19
35
|
expect(client.dataLake.get).to.be.function();
|
|
@@ -27,67 +43,81 @@ describe("Mongo Atlas Api Client - dataLake", () => {
|
|
|
27
43
|
|
|
28
44
|
describe("When get is called with querystring parameters", () => {
|
|
29
45
|
it("should return response", async () => {
|
|
30
|
-
|
|
31
|
-
|
|
46
|
+
mockPool.intercept({
|
|
47
|
+
"path": `/groups/${projectId}/dataLakes/mydataLakename?key1=value1&key2=value2`,
|
|
48
|
+
"method": "GET"
|
|
49
|
+
})
|
|
32
50
|
.reply(200, {"datalake": "name"});
|
|
33
51
|
const result = await client.dataLake.get("mydataLakename", {"key1": "value1", "key2": "value2"});
|
|
34
52
|
expect(result).to.equal({"datalake": "name"});
|
|
35
|
-
|
|
53
|
+
|
|
36
54
|
});
|
|
37
55
|
});
|
|
38
56
|
|
|
39
57
|
describe("When getLogsStream is called with querystring parameters", () => {
|
|
40
58
|
it("should return response", async () => {
|
|
41
|
-
|
|
42
|
-
|
|
59
|
+
mockPool.intercept({
|
|
60
|
+
"path": `/groups/${projectId}/dataLakes/mydataLakename/queryLogs.gz?key1=value1&key2=value2`,
|
|
61
|
+
"method": "GET"
|
|
62
|
+
})
|
|
43
63
|
.reply(200, Buffer.from("Some test string", "utf8"), {"headers": {"accept": "application/gzip"}});
|
|
44
64
|
const result = await client.dataLake.getLogsStream("mydataLakename", {"key1": "value1", "key2": "value2"});
|
|
45
65
|
expect(result.pipe).to.exist();
|
|
46
|
-
|
|
66
|
+
|
|
47
67
|
});
|
|
48
68
|
});
|
|
49
69
|
|
|
50
70
|
describe("When getAll is called with querystring parameters", () => {
|
|
51
71
|
it("should return response", async () => {
|
|
52
|
-
|
|
53
|
-
|
|
72
|
+
mockPool.intercept({
|
|
73
|
+
"path": `/groups/${projectId}/dataLakes?key1=value1&key2=value2`,
|
|
74
|
+
"method": "GET"
|
|
75
|
+
})
|
|
54
76
|
.reply(200, [{"datalake": "name"}]);
|
|
55
77
|
const result = await client.dataLake.getAll({"key1": "value1", "key2": "value2"});
|
|
56
78
|
expect(result).to.equal([{"datalake": "name"}]);
|
|
57
|
-
|
|
79
|
+
|
|
58
80
|
});
|
|
59
81
|
});
|
|
60
82
|
|
|
61
83
|
describe("When update is called with querystring parameters", () => {
|
|
62
84
|
it("should return response", async () => {
|
|
63
|
-
|
|
64
|
-
|
|
85
|
+
mockPool.intercept({
|
|
86
|
+
"path": `/groups/${projectId}/dataLakes/mydataLakename?key1=value1&key2=value2`,
|
|
87
|
+
"method": "PATCH",
|
|
88
|
+
"data": {"body": "value"}
|
|
89
|
+
})
|
|
65
90
|
.reply(200, [{"datalake": "name"}]);
|
|
66
91
|
const result = await client.dataLake.update("mydataLakename", {"body": "value"}, {"key1": "value1", "key2": "value2"});
|
|
67
92
|
expect(result).to.equal([{"datalake": "name"}]);
|
|
68
|
-
|
|
93
|
+
|
|
69
94
|
});
|
|
70
95
|
});
|
|
71
96
|
|
|
72
97
|
describe("When create is called with querystring parameters", () => {
|
|
73
98
|
it("should return response", async () => {
|
|
74
|
-
|
|
75
|
-
|
|
99
|
+
mockPool.intercept({
|
|
100
|
+
"path": `/groups/${projectId}/dataLakes?key1=value1&key2=value2`,
|
|
101
|
+
"method": "POST",
|
|
102
|
+
"data": {"body": "value"}
|
|
103
|
+
})
|
|
76
104
|
.reply(200, [{"dataLakes": "name"}]);
|
|
77
105
|
const result = await client.dataLake.create({"body": "value"}, {"key1": "value1", "key2": "value2"});
|
|
78
106
|
expect(result).to.equal([{"dataLakes": "name"}]);
|
|
79
|
-
|
|
107
|
+
|
|
80
108
|
});
|
|
81
109
|
});
|
|
82
110
|
|
|
83
111
|
describe("When delete is called with querystring parameters", () => {
|
|
84
112
|
it("should return response", async () => {
|
|
85
|
-
|
|
86
|
-
|
|
113
|
+
mockPool.intercept({
|
|
114
|
+
"path": `/groups/${projectId}/dataLakes/mydataLakename?key1=value1&key2=value2`,
|
|
115
|
+
"method": "DELETE"
|
|
116
|
+
})
|
|
87
117
|
.reply(200, true);
|
|
88
118
|
const result = await client.dataLake.delete("mydataLakename", {"key1": "value1", "key2": "value2"});
|
|
89
119
|
expect(result).to.be.true();
|
|
90
|
-
|
|
120
|
+
|
|
91
121
|
});
|
|
92
122
|
});
|
|
93
|
-
});
|
|
123
|
+
});
|
package/test/event.test.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const {describe, it} = exports.lab = require("@hapi/lab").script();
|
|
2
|
-
const {expect} = require(
|
|
3
|
-
const
|
|
4
|
-
const
|
|
1
|
+
const {describe, it, afterEach, before, beforeEach} = exports.lab = require("@hapi/lab").script();
|
|
2
|
+
const {expect} = require('@hapi/code');
|
|
3
|
+
const getClient = require('../src/index.js');
|
|
4
|
+
const {MockAgent, setGlobalDispatcher} = require('urllib');
|
|
5
5
|
|
|
6
|
-
const baseUrl = "http://
|
|
6
|
+
const baseUrl = "http://localhost:7001";
|
|
7
7
|
const projectId = "dummyProjectId";
|
|
8
8
|
|
|
9
9
|
const client = getClient({
|
|
@@ -15,6 +15,21 @@ const client = getClient({
|
|
|
15
15
|
|
|
16
16
|
describe("Mongo Atlas Api Client - Event", () => {
|
|
17
17
|
|
|
18
|
+
let mockAgent;
|
|
19
|
+
let mockPool;
|
|
20
|
+
before(() => {
|
|
21
|
+
mockAgent = new MockAgent();
|
|
22
|
+
setGlobalDispatcher(mockAgent);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
mockPool = mockAgent.get(baseUrl);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
afterEach(() => {
|
|
30
|
+
mockAgent.assertNoPendingInterceptors();
|
|
31
|
+
});
|
|
32
|
+
|
|
18
33
|
describe("When event is exported from index", () => {
|
|
19
34
|
it("should export event functions", async () => {
|
|
20
35
|
expect(client.event.get).to.be.function();
|
|
@@ -26,45 +41,53 @@ describe("Mongo Atlas Api Client - Event", () => {
|
|
|
26
41
|
|
|
27
42
|
describe("When get is called with querystring parameters", () => {
|
|
28
43
|
it("should return response", async () => {
|
|
29
|
-
|
|
30
|
-
|
|
44
|
+
mockPool.intercept({
|
|
45
|
+
"path": `/groups/${projectId}/events/myeventId?key1=value1&key2=value2`,
|
|
46
|
+
"method": "get"
|
|
47
|
+
})
|
|
31
48
|
.reply(200, {"event": "name"});
|
|
32
49
|
const result = await client.event.get("myeventId", {"key1": "value1", "key2": "value2"});
|
|
33
50
|
expect(result).to.equal({"event": "name"});
|
|
34
|
-
|
|
51
|
+
|
|
35
52
|
});
|
|
36
53
|
});
|
|
37
54
|
|
|
38
55
|
describe("When getAll is called with querystring parameters", () => {
|
|
39
56
|
it("should return response", async () => {
|
|
40
|
-
|
|
41
|
-
|
|
57
|
+
mockPool.intercept({
|
|
58
|
+
"path": `/groups/${projectId}/events?key1=value1&key2=value2`,
|
|
59
|
+
"method": "get"
|
|
60
|
+
})
|
|
42
61
|
.reply(200, [{"event": "name"}]);
|
|
43
62
|
const result = await client.event.getAll({"key1": "value1", "key2": "value2"});
|
|
44
63
|
expect(result).to.equal([{"event": "name"}]);
|
|
45
|
-
|
|
64
|
+
|
|
46
65
|
});
|
|
47
66
|
});
|
|
48
67
|
|
|
49
68
|
describe("When getByOrganizationId is called with querystring parameters", () => {
|
|
50
69
|
it("should return response", async () => {
|
|
51
|
-
|
|
52
|
-
|
|
70
|
+
mockPool.intercept({
|
|
71
|
+
"path": "/orgs/myOrgId/events/myeventId?key1=value1&key2=value2",
|
|
72
|
+
"method": "get"
|
|
73
|
+
})
|
|
53
74
|
.reply(200, {"event": "name"});
|
|
54
75
|
const result = await client.event.getByOrganizationId("myOrgId", "myeventId", {"key1": "value1", "key2": "value2"});
|
|
55
76
|
expect(result).to.equal({"event": "name"});
|
|
56
|
-
|
|
77
|
+
|
|
57
78
|
});
|
|
58
79
|
});
|
|
59
80
|
|
|
60
81
|
describe("When getAllByOrganizationId is called with querystring parameters", () => {
|
|
61
82
|
it("should return response", async () => {
|
|
62
|
-
|
|
63
|
-
|
|
83
|
+
mockPool.intercept({
|
|
84
|
+
"path": "/orgs/myOrgId/events?key1=value1&key2=value2",
|
|
85
|
+
"method": "get"
|
|
86
|
+
})
|
|
64
87
|
.reply(200, [{"event": "name"}]);
|
|
65
88
|
const result = await client.event.getAllByOrganizationId("myOrgId", {"key1": "value1", "key2": "value2"});
|
|
66
89
|
expect(result).to.equal([{"event": "name"}]);
|
|
67
|
-
|
|
90
|
+
|
|
68
91
|
});
|
|
69
92
|
});
|
|
70
93
|
});
|
package/test/helper.test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const {describe, it} = exports.lab = require("@hapi/lab").script();
|
|
2
|
-
const {expect} = require(
|
|
3
|
-
const {getQueryStringFromOptions}
|
|
2
|
+
const {expect} = require('@hapi/code');
|
|
3
|
+
const {getQueryStringFromOptions} = require('../src/helper.js');
|
|
4
4
|
|
|
5
5
|
describe("Helper Methods", () => {
|
|
6
6
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const {describe, it} = exports.lab = require("@hapi/lab").script();
|
|
2
|
-
const {expect} = require(
|
|
3
|
-
const
|
|
4
|
-
const
|
|
1
|
+
const {describe, it, afterEach, before, beforeEach} = exports.lab = require("@hapi/lab").script();
|
|
2
|
+
const {expect} = require('@hapi/code');
|
|
3
|
+
const getClient = require('../src/index.js');
|
|
4
|
+
const {MockAgent, setGlobalDispatcher} = require('urllib');
|
|
5
5
|
|
|
6
|
-
const baseUrl = "http://
|
|
6
|
+
const baseUrl = "http://localhost:7001";
|
|
7
7
|
|
|
8
8
|
const client = getClient({
|
|
9
9
|
"publicKey": "dummuyPublicKey",
|
|
@@ -13,6 +13,21 @@ const client = getClient({
|
|
|
13
13
|
|
|
14
14
|
describe("Mongo Atlas Api Client - Organization", () => {
|
|
15
15
|
|
|
16
|
+
let mockAgent;
|
|
17
|
+
let mockPool;
|
|
18
|
+
before(() => {
|
|
19
|
+
mockAgent = new MockAgent();
|
|
20
|
+
setGlobalDispatcher(mockAgent);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
beforeEach(() => {
|
|
24
|
+
mockPool = mockAgent.get(baseUrl);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
afterEach(() => {
|
|
28
|
+
mockAgent.assertNoPendingInterceptors();
|
|
29
|
+
});
|
|
30
|
+
|
|
16
31
|
describe("When organization is exported from index", () => {
|
|
17
32
|
it("should export organization functions", async () => {
|
|
18
33
|
expect(client.organization.getById).to.be.function();
|
|
@@ -27,78 +42,94 @@ describe("Mongo Atlas Api Client - Organization", () => {
|
|
|
27
42
|
|
|
28
43
|
describe("When getById is called with querystring parameters", () => {
|
|
29
44
|
it("should return response", async () => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
45
|
+
mockPool.intercept({
|
|
46
|
+
"path": "/orgs/orgName",
|
|
47
|
+
"query": {"key1": "value1", "key2": "value2"},
|
|
48
|
+
"method": "GET"
|
|
49
|
+
}).reply(200, {"organization": "name"});
|
|
33
50
|
const result = await client.organization.getById("orgName", {"key1": "value1", "key2": "value2"});
|
|
34
51
|
expect(result).to.equal({"organization": "name"});
|
|
35
|
-
|
|
52
|
+
|
|
36
53
|
});
|
|
37
54
|
});
|
|
38
55
|
|
|
39
56
|
describe("When getAllUsersForOrganization is called with querystring parameters", () => {
|
|
40
57
|
it("should return response", async () => {
|
|
41
|
-
|
|
42
|
-
|
|
58
|
+
mockPool.intercept({
|
|
59
|
+
"path": "/orgs/orgId/users?key1=value1&key2=value2",
|
|
60
|
+
"method": "GET"
|
|
61
|
+
})
|
|
43
62
|
.reply(200, {"organization": "name"});
|
|
44
63
|
const result = await client.organization.getAllUsersForOrganization("orgId", {"key1": "value1", "key2": "value2"});
|
|
45
64
|
expect(result).to.equal({"organization": "name"});
|
|
46
|
-
|
|
65
|
+
|
|
47
66
|
});
|
|
48
67
|
});
|
|
49
68
|
|
|
50
69
|
describe("When getAll is called with querystring parameters", () => {
|
|
51
70
|
it("should return response", async () => {
|
|
52
|
-
|
|
53
|
-
|
|
71
|
+
mockPool.intercept({
|
|
72
|
+
"path": "/orgs?key1=value1&key2=value2",
|
|
73
|
+
"method": "GET"
|
|
74
|
+
})
|
|
54
75
|
.reply(200, [{"organization": "name"}]);
|
|
55
76
|
const result = await client.organization.getAll({"key1": "value1", "key2": "value2"});
|
|
56
77
|
expect(result).to.equal([{"organization": "name"}]);
|
|
57
|
-
|
|
78
|
+
|
|
58
79
|
});
|
|
59
80
|
});
|
|
60
81
|
|
|
61
82
|
describe("When rename is called with querystring parameters", () => {
|
|
62
83
|
it("should return response", async () => {
|
|
63
|
-
|
|
64
|
-
|
|
84
|
+
mockPool.intercept({
|
|
85
|
+
"path": "/orgs/orgId?key1=value1&key2=value2",
|
|
86
|
+
"method": "PATCH",
|
|
87
|
+
"data": {"body": "value"}
|
|
88
|
+
})
|
|
65
89
|
.reply(200, [{"organization": "name"}]);
|
|
66
90
|
const result = await client.organization.rename("orgId", {"body": "value"}, {"key1": "value1", "key2": "value2"});
|
|
67
91
|
expect(result).to.equal([{"organization": "name"}]);
|
|
68
|
-
|
|
92
|
+
|
|
69
93
|
});
|
|
70
94
|
});
|
|
71
95
|
|
|
72
96
|
describe("When getAllProjectsForOrganization is called with querystring parameters", () => {
|
|
73
97
|
it("should return response", async () => {
|
|
74
|
-
|
|
75
|
-
|
|
98
|
+
mockPool.intercept({
|
|
99
|
+
"path": "/orgs/orgId/groups?key1=value1&key2=value2",
|
|
100
|
+
"method": "GET"
|
|
101
|
+
})
|
|
76
102
|
.reply(200, [{"organization": "name"}]);
|
|
77
103
|
const result = await client.organization.getAllProjectsForOrganization("orgId", {"key1": "value1", "key2": "value2"});
|
|
78
104
|
expect(result).to.equal([{"organization": "name"}]);
|
|
79
|
-
|
|
105
|
+
|
|
80
106
|
});
|
|
81
107
|
});
|
|
82
108
|
|
|
83
109
|
describe("When delete is called with querystring parameters", () => {
|
|
84
110
|
it("should return response", async () => {
|
|
85
|
-
|
|
86
|
-
|
|
111
|
+
mockPool.intercept({
|
|
112
|
+
"path": "/orgs/orgId?key1=value1&key2=value2",
|
|
113
|
+
"method": "DELETE"
|
|
114
|
+
})
|
|
87
115
|
.reply(200, true);
|
|
88
116
|
const result = await client.organization.delete("orgId", {"key1": "value1", "key2": "value2"});
|
|
89
117
|
expect(result).to.be.true();
|
|
90
|
-
|
|
118
|
+
|
|
91
119
|
});
|
|
92
120
|
});
|
|
93
121
|
|
|
94
122
|
describe("When invite is called with querystring parameters", () => {
|
|
95
123
|
it("should return response", async () => {
|
|
96
|
-
|
|
97
|
-
|
|
124
|
+
mockPool.intercept({
|
|
125
|
+
"path": "/orgs/orgId/invites?key1=value1&key2=value2",
|
|
126
|
+
"method": "POST",
|
|
127
|
+
"data": {"body": "value"}
|
|
128
|
+
})
|
|
98
129
|
.reply(200, [{"organization": "name"}]);
|
|
99
130
|
const result = await client.organization.invite("orgId", {"body": "value"}, {"key1": "value1", "key2": "value2"});
|
|
100
131
|
expect(result).to.equal([{"organization": "name"}]);
|
|
101
|
-
|
|
132
|
+
|
|
102
133
|
});
|
|
103
134
|
});
|
|
104
135
|
});
|
package/test/project.test.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const {describe, it} = exports.lab = require("@hapi/lab").script();
|
|
2
|
-
const {expect} = require(
|
|
3
|
-
const
|
|
4
|
-
const
|
|
1
|
+
const {describe, it, afterEach, before, beforeEach} = exports.lab = require("@hapi/lab").script();
|
|
2
|
+
const {expect} = require('@hapi/code');
|
|
3
|
+
const getClient = require('../src/index.js');
|
|
4
|
+
const {MockAgent, setGlobalDispatcher} = require('urllib');
|
|
5
5
|
|
|
6
|
-
const baseUrl = "http://
|
|
6
|
+
const baseUrl = "http://localhost:7001";
|
|
7
7
|
|
|
8
8
|
const client = getClient({
|
|
9
9
|
"publicKey": "dummuyPublicKey",
|
|
@@ -13,6 +13,21 @@ const client = getClient({
|
|
|
13
13
|
|
|
14
14
|
describe("Mongo Atlas Api Client - Project", () => {
|
|
15
15
|
|
|
16
|
+
let mockAgent;
|
|
17
|
+
let mockPool;
|
|
18
|
+
before(() => {
|
|
19
|
+
mockAgent = new MockAgent();
|
|
20
|
+
setGlobalDispatcher(mockAgent);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
beforeEach(() => {
|
|
24
|
+
mockPool = mockAgent.get(baseUrl);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
afterEach(() => {
|
|
28
|
+
mockAgent.assertNoPendingInterceptors();
|
|
29
|
+
});
|
|
30
|
+
|
|
16
31
|
describe("When project is exported from index", () => {
|
|
17
32
|
it("should export project functions", async () => {
|
|
18
33
|
expect(client.project.getById).to.be.function();
|
|
@@ -28,89 +43,107 @@ describe("Mongo Atlas Api Client - Project", () => {
|
|
|
28
43
|
|
|
29
44
|
describe("When getById is called with querystring parameters", () => {
|
|
30
45
|
it("should return response", async () => {
|
|
31
|
-
|
|
32
|
-
|
|
46
|
+
mockPool.intercept({
|
|
47
|
+
"path": "/groups/projectId?key1=value1&key2=value2",
|
|
48
|
+
"method": "GET"
|
|
49
|
+
})
|
|
33
50
|
.reply(200, {"project": "name"});
|
|
34
51
|
const result = await client.project.getById("projectId", {"key1": "value1", "key2": "value2"});
|
|
35
52
|
expect(result).to.equal({"project": "name"});
|
|
36
|
-
|
|
53
|
+
|
|
37
54
|
});
|
|
38
55
|
});
|
|
39
56
|
|
|
40
57
|
describe("When getByName is called with querystring parameters", () => {
|
|
41
58
|
it("should return response", async () => {
|
|
42
|
-
|
|
43
|
-
|
|
59
|
+
mockPool.intercept({
|
|
60
|
+
"path": "/groups/byName/projectName?key1=value1&key2=value2",
|
|
61
|
+
"method": "GET"
|
|
62
|
+
})
|
|
44
63
|
.reply(200, {"project": "name"});
|
|
45
64
|
const result = await client.project.getByName("projectName", {"key1": "value1", "key2": "value2"});
|
|
46
65
|
expect(result).to.equal({"project": "name"});
|
|
47
|
-
|
|
66
|
+
|
|
48
67
|
});
|
|
49
68
|
});
|
|
50
69
|
|
|
51
70
|
describe("When getTeamsByProjectId is called with querystring parameters", () => {
|
|
52
71
|
it("should return response", async () => {
|
|
53
|
-
|
|
54
|
-
|
|
72
|
+
mockPool.intercept({
|
|
73
|
+
"path": "/groups/projectId/teams?key1=value1&key2=value2",
|
|
74
|
+
"method": "GET"
|
|
75
|
+
})
|
|
55
76
|
.reply(200, {"project": "name"});
|
|
56
77
|
const result = await client.project.getTeamsByProjectId("projectId", {"key1": "value1", "key2": "value2"});
|
|
57
78
|
expect(result).to.equal({"project": "name"});
|
|
58
|
-
|
|
79
|
+
|
|
59
80
|
});
|
|
60
81
|
});
|
|
61
82
|
|
|
62
83
|
describe("When getAll is called with querystring parameters", () => {
|
|
63
84
|
it("should return response", async () => {
|
|
64
|
-
|
|
65
|
-
|
|
85
|
+
mockPool.intercept({
|
|
86
|
+
"path": "/groups?key1=value1&key2=value2",
|
|
87
|
+
"method": "GET"
|
|
88
|
+
})
|
|
66
89
|
.reply(200, [{"project": "name"}]);
|
|
67
90
|
const result = await client.project.getAll({"key1": "value1", "key2": "value2"});
|
|
68
91
|
expect(result).to.equal([{"project": "name"}]);
|
|
69
|
-
|
|
92
|
+
|
|
70
93
|
});
|
|
71
94
|
});
|
|
72
95
|
|
|
73
96
|
describe("When assignTeams is called with querystring parameters", () => {
|
|
74
97
|
it("should return response", async () => {
|
|
75
|
-
|
|
76
|
-
|
|
98
|
+
mockPool.intercept({
|
|
99
|
+
"path": "/groups/projectId/teams?key1=value1&key2=value2",
|
|
100
|
+
"method": "POST",
|
|
101
|
+
"data": {"body": "value"}
|
|
102
|
+
})
|
|
77
103
|
.reply(200, [{"project": "name"}]);
|
|
78
104
|
const result = await client.project.assignTeams("projectId", {"body": "value"}, {"key1": "value1", "key2": "value2"});
|
|
79
105
|
expect(result).to.equal([{"project": "name"}]);
|
|
80
|
-
|
|
106
|
+
|
|
81
107
|
});
|
|
82
108
|
});
|
|
83
109
|
|
|
84
110
|
describe("When create is called with querystring parameters", () => {
|
|
85
111
|
it("should return response", async () => {
|
|
86
|
-
|
|
87
|
-
|
|
112
|
+
mockPool.intercept({
|
|
113
|
+
"path": "/groups?key1=value1&key2=value2",
|
|
114
|
+
"method": "POST",
|
|
115
|
+
"data": {"body": "value"}
|
|
116
|
+
})
|
|
88
117
|
.reply(200, [{"project": "name"}]);
|
|
89
118
|
const result = await client.project.create({"body": "value"}, {"key1": "value1", "key2": "value2"});
|
|
90
119
|
expect(result).to.equal([{"project": "name"}]);
|
|
91
|
-
|
|
120
|
+
|
|
92
121
|
});
|
|
93
122
|
});
|
|
94
123
|
|
|
95
124
|
describe("When delete is called with querystring parameters", () => {
|
|
96
125
|
it("should return response", async () => {
|
|
97
|
-
|
|
98
|
-
|
|
126
|
+
mockPool.intercept({
|
|
127
|
+
"path": "/groups/projectId?key1=value1&key2=value2",
|
|
128
|
+
"method": "DELETE"
|
|
129
|
+
})
|
|
99
130
|
.reply(200, true);
|
|
100
131
|
const result = await client.project.delete("projectId", {"key1": "value1", "key2": "value2"});
|
|
101
132
|
expect(result).to.be.true();
|
|
102
|
-
|
|
133
|
+
|
|
103
134
|
});
|
|
104
135
|
});
|
|
105
136
|
|
|
106
137
|
describe("When removeUserFromProject is called with querystring parameters", () => {
|
|
107
138
|
it("should return response", async () => {
|
|
108
|
-
|
|
109
|
-
|
|
139
|
+
mockPool.intercept({
|
|
140
|
+
"path": "/groups/projectId/users/userId?key1=value1&key2=value2",
|
|
141
|
+
"method": "DELETE"
|
|
142
|
+
})
|
|
110
143
|
.reply(200, true);
|
|
111
144
|
const result = await client.project.removeUserFromProject("projectId", "userId", {"key1": "value1", "key2": "value2"});
|
|
112
145
|
expect(result).to.be.true();
|
|
113
|
-
|
|
146
|
+
|
|
114
147
|
});
|
|
115
148
|
});
|
|
116
149
|
});
|