k2hr3-api 1.0.42 → 2.0.0
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/config/k2hr3-init.sh.templ +2 -2
- package/dist/.gitkeep +0 -0
- package/dist/src/app.js +262 -0
- package/{bin → dist/src/bin}/run.sh +1 -1
- package/dist/src/bin/watcher.js +113 -0
- package/dist/src/bin/www.js +217 -0
- package/dist/src/lib/basicipcheck.js +392 -0
- package/dist/src/lib/cacerts.js +106 -0
- package/dist/src/lib/dbglogging.js +190 -0
- package/dist/src/lib/dummyuserapi.js +719 -0
- package/dist/src/lib/ipwatch.js +354 -0
- package/dist/src/lib/k2hr3acrutil.js +532 -0
- package/dist/src/lib/k2hr3apiutil.js +1444 -0
- package/dist/src/lib/k2hr3cliutil.js +183 -0
- package/dist/src/lib/k2hr3config.js +832 -0
- package/dist/src/lib/k2hr3cryptutil.js +258 -0
- package/dist/src/lib/k2hr3dkc.js +12121 -0
- package/dist/src/lib/k2hr3extdata.js +198 -0
- package/dist/src/lib/k2hr3keys.js +207 -0
- package/dist/src/lib/k2hr3resutil.js +111 -0
- package/dist/src/lib/k2hr3template.js +6546 -0
- package/dist/src/lib/k2hr3tokens.js +2643 -0
- package/dist/src/lib/k2hr3userdata.js +296 -0
- package/dist/src/lib/k8soidc.js +1000 -0
- package/dist/src/lib/openstackapiv2.js +695 -0
- package/dist/src/lib/openstackapiv3.js +932 -0
- package/dist/src/lib/openstackep.js +667 -0
- package/{tests/auto_common.js → dist/src/lib/types.js} +4 -38
- package/dist/src/routes/acr.js +704 -0
- package/dist/src/routes/debugVerify.js +294 -0
- package/dist/src/routes/extdata.js +219 -0
- package/dist/src/routes/list.js +264 -0
- package/dist/src/routes/policy.js +840 -0
- package/dist/src/routes/resource.js +1489 -0
- package/dist/src/routes/role.js +2627 -0
- package/dist/src/routes/service.js +908 -0
- package/dist/src/routes/tenant.js +1141 -0
- package/dist/src/routes/userTokens.js +482 -0
- package/dist/src/routes/userdata.js +212 -0
- package/dist/src/routes/version.js +103 -0
- package/package.json +152 -121
- package/ChangeLog +0 -378
- package/app.js +0 -292
- package/bin/watcher +0 -122
- package/bin/www +0 -180
- package/eslint.config.mjs +0 -68
- package/lib/basicipcheck.js +0 -376
- package/lib/cacerts.js +0 -71
- package/lib/dbglogging.js +0 -151
- package/lib/dummyuserapi.js +0 -766
- package/lib/ipwatch.js +0 -379
- package/lib/k2hr3acrutil.js +0 -516
- package/lib/k2hr3apiutil.js +0 -1494
- package/lib/k2hr3cliutil.js +0 -191
- package/lib/k2hr3config.js +0 -826
- package/lib/k2hr3cryptutil.js +0 -254
- package/lib/k2hr3dkc.js +0 -12632
- package/lib/k2hr3extdata.js +0 -198
- package/lib/k2hr3keys.js +0 -234
- package/lib/k2hr3resutil.js +0 -100
- package/lib/k2hr3template.js +0 -6925
- package/lib/k2hr3tokens.js +0 -2799
- package/lib/k2hr3userdata.js +0 -312
- package/lib/k8soidc.js +0 -1012
- package/lib/openstackapiv2.js +0 -764
- package/lib/openstackapiv3.js +0 -1032
- package/lib/openstackep.js +0 -553
- package/routes/acr.js +0 -738
- package/routes/debugVerify.js +0 -263
- package/routes/extdata.js +0 -232
- package/routes/list.js +0 -270
- package/routes/policy.js +0 -869
- package/routes/resource.js +0 -1441
- package/routes/role.js +0 -2664
- package/routes/service.js +0 -894
- package/routes/tenant.js +0 -1095
- package/routes/userTokens.js +0 -511
- package/routes/userdata.js +0 -218
- package/routes/version.js +0 -108
- package/templ/Dockerfile.templ +0 -71
- package/tests/auto_acr.js +0 -1101
- package/tests/auto_acr_spec.js +0 -79
- package/tests/auto_all_spec.js +0 -142
- package/tests/auto_control_subprocess.sh +0 -243
- package/tests/auto_extdata.js +0 -220
- package/tests/auto_extdata_spec.js +0 -79
- package/tests/auto_init_config_json.sh +0 -275
- package/tests/auto_k2hdkc_server.ini +0 -109
- package/tests/auto_k2hdkc_slave.ini +0 -83
- package/tests/auto_list.js +0 -439
- package/tests/auto_list_spec.js +0 -79
- package/tests/auto_policy.js +0 -1579
- package/tests/auto_policy_spec.js +0 -79
- package/tests/auto_resource.js +0 -10956
- package/tests/auto_resource_spec.js +0 -79
- package/tests/auto_role.js +0 -6150
- package/tests/auto_role_spec.js +0 -79
- package/tests/auto_service.js +0 -770
- package/tests/auto_service_spec.js +0 -79
- package/tests/auto_subprocesses.js +0 -114
- package/tests/auto_template.sh +0 -126
- package/tests/auto_tenant.js +0 -1100
- package/tests/auto_tenant_spec.js +0 -79
- package/tests/auto_token_util.js +0 -219
- package/tests/auto_userdata.js +0 -292
- package/tests/auto_userdata_spec.js +0 -79
- package/tests/auto_usertokens.js +0 -565
- package/tests/auto_usertokens_spec.js +0 -79
- package/tests/auto_version.js +0 -127
- package/tests/auto_version_spec.js +0 -79
- package/tests/auto_watcher.js +0 -157
- package/tests/auto_watcher_spec.js +0 -79
- package/tests/k2hdkc_test.data +0 -986
- package/tests/k2hdkc_test_load.sh +0 -255
- package/tests/k2hr3template_test.js +0 -187
- package/tests/k2hr3template_test.sh +0 -339
- package/tests/k2hr3template_test_async.js +0 -216
- package/tests/k2hr3template_test_template.result +0 -7117
- package/tests/k2hr3template_test_template.txt +0 -3608
- package/tests/k2hr3template_test_vars.js +0 -194
- package/tests/manual_acr_delete.js +0 -143
- package/tests/manual_acr_get.js +0 -297
- package/tests/manual_acr_postput.js +0 -215
- package/tests/manual_allusertenant_get.js +0 -113
- package/tests/manual_extdata_get.js +0 -191
- package/tests/manual_k2hr3keys_get.js +0 -84
- package/tests/manual_list_gethead.js +0 -230
- package/tests/manual_policy_delete.js +0 -132
- package/tests/manual_policy_gethead.js +0 -275
- package/tests/manual_policy_postput.js +0 -297
- package/tests/manual_resource_delete.js +0 -433
- package/tests/manual_resource_gethead.js +0 -423
- package/tests/manual_resource_postput.js +0 -487
- package/tests/manual_role_delete.js +0 -404
- package/tests/manual_role_gethead.js +0 -547
- package/tests/manual_role_postput.js +0 -544
- package/tests/manual_service_delete.js +0 -153
- package/tests/manual_service_gethead.js +0 -178
- package/tests/manual_service_postput.js +0 -348
- package/tests/manual_tenant_delete.js +0 -186
- package/tests/manual_tenant_gethead.js +0 -268
- package/tests/manual_tenant_postput.js +0 -293
- package/tests/manual_test.sh +0 -352
- package/tests/manual_userdata_get.js +0 -173
- package/tests/manual_usertoken_gethead.js +0 -136
- package/tests/manual_usertoken_postput.js +0 -310
- package/tests/manual_version_get.js +0 -127
- package/tests/run_local_test_k2hdkc.sh +0 -174
- package/tests/test.sh +0 -333
package/tests/auto_list.js
DELETED
|
@@ -1,439 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* K2HR3 REST API
|
|
3
|
-
*
|
|
4
|
-
* Copyright 2017 Yahoo Japan Corporation.
|
|
5
|
-
*
|
|
6
|
-
* K2HR3 is K2hdkc based Resource and Roles and policy Rules, gathers
|
|
7
|
-
* common management information for the cloud.
|
|
8
|
-
* K2HR3 can dynamically manage information as "who", "what", "operate".
|
|
9
|
-
* These are stored as roles, resources, policies in K2hdkc, and the
|
|
10
|
-
* client system can dynamically read and modify these information.
|
|
11
|
-
*
|
|
12
|
-
* For the full copyright and license information, please view
|
|
13
|
-
* the license file that was distributed with this source code.
|
|
14
|
-
*
|
|
15
|
-
* AUTHOR: Takeshi Nakatani
|
|
16
|
-
* CREATE: Tue Dec 19 2017
|
|
17
|
-
* REVISION:
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
'use strict';
|
|
22
|
-
|
|
23
|
-
var common = require('./auto_common'); // Common objects for Chai
|
|
24
|
-
var chai = common.chai;
|
|
25
|
-
var chaiHttp = common.chaiHttp; // eslint-disable-line no-unused-vars
|
|
26
|
-
var app = common.app;
|
|
27
|
-
var assert = common.assert; // eslint-disable-line no-unused-vars
|
|
28
|
-
var expect = common.expect;
|
|
29
|
-
var tokenutil = require('./auto_token_util'); // Token utility
|
|
30
|
-
|
|
31
|
-
//--------------------------------------------------------------
|
|
32
|
-
// Main describe section
|
|
33
|
-
//--------------------------------------------------------------
|
|
34
|
-
describe('API : LIST', function(){ // eslint-disable-line no-undef
|
|
35
|
-
var alltokens = {};
|
|
36
|
-
|
|
37
|
-
//
|
|
38
|
-
// Before in describe section
|
|
39
|
-
//
|
|
40
|
-
before(function(done){ // eslint-disable-line no-undef
|
|
41
|
-
// Nothing to do
|
|
42
|
-
tokenutil.before(this, alltokens, done);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
//
|
|
46
|
-
// After in describe section
|
|
47
|
-
//
|
|
48
|
-
after(function(){ // eslint-disable-line no-undef
|
|
49
|
-
// Nothing to do
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
// 1.1 GET /v1/list/policy HTTP/1.1
|
|
53
|
-
it('GET /v1/list/policy with status 200', function(done){ // eslint-disable-line no-undef
|
|
54
|
-
chai.request(app)
|
|
55
|
-
.get('/v1/list/policy')
|
|
56
|
-
.set('x-auth-token', alltokens.scopedtoken.tenant0)
|
|
57
|
-
.end(function(err, res){
|
|
58
|
-
expect(res).to.have.status(200);
|
|
59
|
-
expect(res).to.be.json;
|
|
60
|
-
expect(res.body).to.be.an('object');
|
|
61
|
-
expect(res.body.result).to.be.a('boolean').to.be.true;
|
|
62
|
-
expect(res.body.message).to.be.null;
|
|
63
|
-
expect(res.body.children).to.have.lengthOf(6);
|
|
64
|
-
done();
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
// 1.1.1 GET /v1/list/policy/acr-policy HTTP/1.1
|
|
69
|
-
it('GET /v1/list/policy/acr-policy with status 200', function(done){ // eslint-disable-line no-undef
|
|
70
|
-
chai.request(app)
|
|
71
|
-
.get('/v1/list/policy/acr-policy')
|
|
72
|
-
.set('x-auth-token', alltokens.scopedtoken.tenant0)
|
|
73
|
-
.end(function(err, res){
|
|
74
|
-
expect(res).to.have.status(200);
|
|
75
|
-
expect(res).to.be.json;
|
|
76
|
-
expect(res.body).to.be.an('object');
|
|
77
|
-
expect(res.body.result).to.be.a('boolean').to.be.true;
|
|
78
|
-
expect(res.body.message).to.be.null;
|
|
79
|
-
expect(res.body.children).to.have.lengthOf(0);
|
|
80
|
-
done();
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
// 1.2 GET /v1/list/policy?expand=true HTTP/1.1
|
|
85
|
-
it('GET /v1/list/policy?expand=true with status 200', function(done){ // eslint-disable-line no-undef
|
|
86
|
-
chai.request(app)
|
|
87
|
-
.get('/v1/list/policy?expand=true')
|
|
88
|
-
.set('x-auth-token', alltokens.scopedtoken.tenant0)
|
|
89
|
-
.end(function(err, res){
|
|
90
|
-
expect(res).to.have.status(200);
|
|
91
|
-
expect(res).to.be.json;
|
|
92
|
-
expect(res.body).to.be.an('object');
|
|
93
|
-
expect(res.body.result).to.be.a('boolean').to.be.true;
|
|
94
|
-
expect(res.body.message).to.be.null;
|
|
95
|
-
expect(res.body.children).to.have.lengthOf(6);
|
|
96
|
-
done();
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
// 1.4 GET /v1/list/policy HTTP/1.1
|
|
101
|
-
it('GET /v1/list/policy with invalid x-auth-token header', function(done){ // eslint-disable-line no-undef
|
|
102
|
-
chai.request(app)
|
|
103
|
-
.get('/v1/list/policy')
|
|
104
|
-
.set('x-auth-token', 'x')
|
|
105
|
-
.end(function(err, res){
|
|
106
|
-
expect(res).to.have.status(401);
|
|
107
|
-
expect(res).to.be.json;
|
|
108
|
-
expect(res.body).to.be.an('object');
|
|
109
|
-
expect(res.body.result).to.be.a('boolean').to.be.false;
|
|
110
|
-
expect(res.body.message).to.have.string('token(x) is not existed, because it is expired or not set yet.');
|
|
111
|
-
done();
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
// 1.5 GET /v1/list/policy?expand=x HTTP/1.1
|
|
116
|
-
it('GET /v1/list/policy?expand=x with invalid expand urlparam', function(done){ // eslint-disable-line no-undef
|
|
117
|
-
chai.request(app)
|
|
118
|
-
.get('/v1/list/policy?expand=x')
|
|
119
|
-
.set('x-auth-token', alltokens.scopedtoken.tenant0)
|
|
120
|
-
.end(function(err, res){
|
|
121
|
-
expect(res).to.have.status(400);
|
|
122
|
-
expect(res).to.be.json;
|
|
123
|
-
expect(res.body).to.be.an('object');
|
|
124
|
-
expect(res.body.result).to.be.a('boolean').to.be.false;
|
|
125
|
-
expect(res.body.message).to.have.string('GET/HEAD expand url argument parameter("x") is wrong, it must be true or false.');
|
|
126
|
-
done();
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
// 2.1 GET /v1/list/resource HTTP/1.1
|
|
131
|
-
it('GET /v1/list/resource with status 200', function(done){ // eslint-disable-line no-undef
|
|
132
|
-
chai.request(app)
|
|
133
|
-
.get('/v1/list/resource')
|
|
134
|
-
.set('x-auth-token', alltokens.scopedtoken.tenant0)
|
|
135
|
-
.end(function(err, res){
|
|
136
|
-
expect(res).to.have.status(200);
|
|
137
|
-
expect(res).to.be.json;
|
|
138
|
-
expect(res.body).to.be.an('object');
|
|
139
|
-
expect(res.body.result).to.be.a('boolean').to.be.true;
|
|
140
|
-
expect(res.body.message).to.be.null;
|
|
141
|
-
expect(res.body.children).to.have.lengthOf(4);
|
|
142
|
-
done();
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
// 2.1.1 GET /v1/list/resource/test_service_resource HTTP/1.1
|
|
147
|
-
it('GET /v1/list/resource/test_service_resource with status 200', function(done){ // eslint-disable-line no-undef
|
|
148
|
-
chai.request(app)
|
|
149
|
-
.get('/v1/list/resource/test_service_resource')
|
|
150
|
-
.set('x-auth-token', alltokens.scopedtoken.tenant0)
|
|
151
|
-
.end(function(err, res){
|
|
152
|
-
expect(res).to.have.status(200);
|
|
153
|
-
expect(res).to.be.json;
|
|
154
|
-
expect(res.body).to.be.an('object');
|
|
155
|
-
expect(res.body.result).to.be.a('boolean').to.be.true;
|
|
156
|
-
expect(res.body.message).to.be.null;
|
|
157
|
-
expect(res.body.children).to.have.lengthOf(0);
|
|
158
|
-
done();
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
// 2.2 GET /v1/list/resource?expand=true HTTP/1.1
|
|
163
|
-
it('GET /v1/list/resource?expand=true with status 200', function(done){ // eslint-disable-line no-undef
|
|
164
|
-
chai.request(app)
|
|
165
|
-
.get('/v1/list/resource?expand=true')
|
|
166
|
-
.set('x-auth-token', alltokens.scopedtoken.tenant0)
|
|
167
|
-
.end(function(err, res){
|
|
168
|
-
expect(res).to.have.status(200);
|
|
169
|
-
expect(res).to.be.json;
|
|
170
|
-
expect(res.body).to.be.an('object');
|
|
171
|
-
expect(res.body.result).to.be.a('boolean').to.be.true;
|
|
172
|
-
expect(res.body.message).to.be.null;
|
|
173
|
-
expect(res.body.children).to.have.lengthOf(4);
|
|
174
|
-
done();
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
// 2.4 GET /v1/list/resource HTTP/1.1
|
|
179
|
-
it('GET /v1/list/resource with invalid x-auth-token header', function(done){ // eslint-disable-line no-undef
|
|
180
|
-
chai.request(app)
|
|
181
|
-
.get('/v1/list/resource')
|
|
182
|
-
.set('x-auth-token', 'x')
|
|
183
|
-
.end(function(err, res){
|
|
184
|
-
expect(res).to.have.status(401);
|
|
185
|
-
expect(res).to.be.json;
|
|
186
|
-
expect(res.body).to.be.an('object');
|
|
187
|
-
expect(res.body.result).to.be.a('boolean').to.be.false;
|
|
188
|
-
expect(res.body.message).to.have.string('token(x) is not existed, because it is expired or not set yet.');
|
|
189
|
-
done();
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
// 2.5 GET /v1/list/resource?expand=x HTTP/1.1
|
|
194
|
-
it('GET /v1/list/resource?expand=x with invalid expand urlparam', function(done){ // eslint-disable-line no-undef
|
|
195
|
-
chai.request(app)
|
|
196
|
-
.get('/v1/list/resource?expand=x')
|
|
197
|
-
.set('x-auth-token', alltokens.scopedtoken.tenant0)
|
|
198
|
-
.end(function(err, res){
|
|
199
|
-
expect(res).to.have.status(400);
|
|
200
|
-
expect(res).to.be.json;
|
|
201
|
-
expect(res.body).to.be.an('object');
|
|
202
|
-
expect(res.body.result).to.be.a('boolean').to.be.false;
|
|
203
|
-
expect(res.body.message).to.have.string('GET/HEAD expand url argument parameter("x") is wrong, it must be true or false.');
|
|
204
|
-
done();
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
// 3.1 GET /v1/list/role HTTP/1.1
|
|
209
|
-
it('GET /v1/list/role with status 200', function(done){ // eslint-disable-line no-undef
|
|
210
|
-
chai.request(app)
|
|
211
|
-
.get('/v1/list/role')
|
|
212
|
-
.set('x-auth-token', alltokens.scopedtoken.tenant0)
|
|
213
|
-
.end(function(err, res){
|
|
214
|
-
expect(res).to.have.status(200);
|
|
215
|
-
expect(res).to.be.json;
|
|
216
|
-
expect(res.body).to.be.an('object');
|
|
217
|
-
expect(res.body.result).to.be.a('boolean').to.be.true;
|
|
218
|
-
expect(res.body.message).to.be.null;
|
|
219
|
-
expect(res.body.children).to.have.lengthOf(6);
|
|
220
|
-
done();
|
|
221
|
-
});
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
// 3.1.1 GET /v1/list/role/acr-role HTTP/1.1
|
|
225
|
-
it('GET /v1/list/role/acr-role with status 200', function(done){ // eslint-disable-line no-undef
|
|
226
|
-
chai.request(app)
|
|
227
|
-
.get('/v1/list/role/acr-role')
|
|
228
|
-
.set('x-auth-token', alltokens.scopedtoken.tenant0)
|
|
229
|
-
.end(function(err, res){
|
|
230
|
-
expect(res).to.have.status(200);
|
|
231
|
-
expect(res).to.be.json;
|
|
232
|
-
expect(res.body).to.be.an('object');
|
|
233
|
-
expect(res.body.result).to.be.a('boolean').to.be.true;
|
|
234
|
-
expect(res.body.message).to.be.null;
|
|
235
|
-
expect(res.body.children).to.have.lengthOf(0);
|
|
236
|
-
done();
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
// 3.2 GET /v1/list/role?expand=true HTTP/1.1
|
|
241
|
-
it('GET /v1/list/role?expand=true with status 200', function(done){ // eslint-disable-line no-undef
|
|
242
|
-
chai.request(app)
|
|
243
|
-
.get('/v1/list/role?expand=true')
|
|
244
|
-
.set('x-auth-token', alltokens.scopedtoken.tenant0)
|
|
245
|
-
.end(function(err, res){
|
|
246
|
-
expect(res).to.have.status(200);
|
|
247
|
-
expect(res).to.be.json;
|
|
248
|
-
expect(res.body).to.be.an('object');
|
|
249
|
-
expect(res.body.result).to.be.a('boolean').to.be.true;
|
|
250
|
-
expect(res.body.message).to.be.null;
|
|
251
|
-
expect(res.body.children).to.have.lengthOf(6);
|
|
252
|
-
done();
|
|
253
|
-
});
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
// 3.4 GET /v1/list/role HTTP/1.1
|
|
257
|
-
it('GET /v1/list/role with invalid x-auth-token header', function(done){ // eslint-disable-line no-undef
|
|
258
|
-
chai.request(app)
|
|
259
|
-
.get('/v1/list/role')
|
|
260
|
-
.set('x-auth-token', 'x')
|
|
261
|
-
.end(function(err, res){
|
|
262
|
-
expect(res).to.have.status(401);
|
|
263
|
-
expect(res).to.be.json;
|
|
264
|
-
expect(res.body).to.be.an('object');
|
|
265
|
-
expect(res.body.result).to.be.a('boolean').to.be.false;
|
|
266
|
-
expect(res.body.message).to.have.string('token(x) is not existed, because it is expired or not set yet.');
|
|
267
|
-
done();
|
|
268
|
-
});
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
// 3.5 GET /v1/list/role?expand=x HTTP/1.1
|
|
272
|
-
it('GET /v1/list/role?expand=x with invalid expand urlparam', function(done){ // eslint-disable-line no-undef
|
|
273
|
-
chai.request(app)
|
|
274
|
-
.get('/v1/list/role?expand=x')
|
|
275
|
-
.set('x-auth-token', alltokens.scopedtoken.tenant0)
|
|
276
|
-
.end(function(err, res){
|
|
277
|
-
expect(res).to.have.status(400);
|
|
278
|
-
expect(res).to.be.json;
|
|
279
|
-
expect(res.body).to.be.an('object');
|
|
280
|
-
expect(res.body.result).to.be.a('boolean').to.be.false;
|
|
281
|
-
expect(res.body.message).to.have.string('GET/HEAD expand url argument parameter("x") is wrong, it must be true or false.');
|
|
282
|
-
done();
|
|
283
|
-
});
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
// 4.1 GET /v1/list/service HTTP/1.1
|
|
287
|
-
it('GET /v1/list/service with status 200', function(done){ // eslint-disable-line no-undef
|
|
288
|
-
chai.request(app)
|
|
289
|
-
.get('/v1/list/service')
|
|
290
|
-
.set('x-auth-token', alltokens.scopedtoken.tenant0)
|
|
291
|
-
.end(function(err, res){
|
|
292
|
-
expect(res).to.have.status(200);
|
|
293
|
-
expect(res).to.be.json;
|
|
294
|
-
expect(res.body).to.be.an('object');
|
|
295
|
-
expect(res.body.result).to.be.a('boolean').to.be.true;
|
|
296
|
-
expect(res.body.message).to.be.null;
|
|
297
|
-
expect(res.body.children).to.have.lengthOf(1);
|
|
298
|
-
expect(res.body.children[0]).to.deep.equal({'name':'testservice','children':[]});
|
|
299
|
-
done();
|
|
300
|
-
});
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
// 4.2 GET /v1/list/service?expand=true HTTP/1.1
|
|
304
|
-
it('GET /v1/list/service?expand=true with status 200', function(done){ // eslint-disable-line no-undef
|
|
305
|
-
chai.request(app)
|
|
306
|
-
.get('/v1/list/service?expand=true')
|
|
307
|
-
.set('x-auth-token', alltokens.scopedtoken.tenant0)
|
|
308
|
-
.end(function(err, res){
|
|
309
|
-
expect(res).to.have.status(200);
|
|
310
|
-
expect(res).to.be.json;
|
|
311
|
-
expect(res.body).to.be.an('object');
|
|
312
|
-
expect(res.body.result).to.be.a('boolean').to.be.true;
|
|
313
|
-
expect(res.body.message).to.be.null;
|
|
314
|
-
expect(res.body.children).to.have.lengthOf(1);
|
|
315
|
-
expect(res.body.children[0]).to.deep.equal({'name':'testservice','children':[]});
|
|
316
|
-
done();
|
|
317
|
-
});
|
|
318
|
-
});
|
|
319
|
-
|
|
320
|
-
// 4.4 GET /v1/list/service HTTP/1.1
|
|
321
|
-
it('GET /v1/list/service with invalid x-auth-token header', function(done){ // eslint-disable-line no-undef
|
|
322
|
-
chai.request(app)
|
|
323
|
-
.get('/v1/list/service')
|
|
324
|
-
.set('x-auth-token', 'x')
|
|
325
|
-
.end(function(err, res){
|
|
326
|
-
expect(res).to.have.status(401);
|
|
327
|
-
expect(res).to.be.json;
|
|
328
|
-
expect(res.body).to.be.an('object');
|
|
329
|
-
expect(res.body.result).to.be.a('boolean').to.be.false;
|
|
330
|
-
expect(res.body.message).to.have.string('token(x) is not existed, because it is expired or not set yet.');
|
|
331
|
-
done();
|
|
332
|
-
});
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
// 4.5 GET /v1/list/service?expand=x HTTP/1.1
|
|
336
|
-
it('GET /v1/list/service?expand=x with invalid expand urlparam', function(done){ // eslint-disable-line no-undef
|
|
337
|
-
chai.request(app)
|
|
338
|
-
.get('/v1/list/service?expand=x')
|
|
339
|
-
.set('x-auth-token', alltokens.scopedtoken.tenant0)
|
|
340
|
-
.end(function(err, res){
|
|
341
|
-
expect(res).to.have.status(400);
|
|
342
|
-
expect(res).to.be.json;
|
|
343
|
-
expect(res.body).to.be.an('object');
|
|
344
|
-
expect(res.body.result).to.be.a('boolean').to.be.false;
|
|
345
|
-
expect(res.body.message).to.have.string('GET/HEAD expand url argument parameter("x") is wrong, it must be true or false.');
|
|
346
|
-
done();
|
|
347
|
-
});
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
// 5. HEAD /v1/list/service HTTP/1.1
|
|
351
|
-
it('HEAD /v1/list/service with status 204', function(done){ // eslint-disable-line no-undef
|
|
352
|
-
chai.request(app)
|
|
353
|
-
.head('/v1/list/service')
|
|
354
|
-
.set('x-auth-token', alltokens.scopedtoken.tenant0)
|
|
355
|
-
.end(function(err, res){
|
|
356
|
-
expect(res).to.have.status(204);
|
|
357
|
-
expect(res.body).to.be.empty;
|
|
358
|
-
done();
|
|
359
|
-
});
|
|
360
|
-
});
|
|
361
|
-
|
|
362
|
-
// 6. HEAD /v1/list/resource HTTP/1.1
|
|
363
|
-
it('HEAD /v1/list/resource with status 204', function(done){ // eslint-disable-line no-undef
|
|
364
|
-
chai.request(app)
|
|
365
|
-
.head('/v1/list/resource')
|
|
366
|
-
.set('x-auth-token', alltokens.scopedtoken.tenant0)
|
|
367
|
-
.end(function(err, res){
|
|
368
|
-
expect(res).to.have.status(204);
|
|
369
|
-
expect(res.body).to.be.empty;
|
|
370
|
-
done();
|
|
371
|
-
});
|
|
372
|
-
});
|
|
373
|
-
// 6.1 HEAD /v1/list/resource/test_service_resource HTTP/1.1
|
|
374
|
-
it('HEAD /v1/list/resource/test_service_resource with status 204', function(done){ // eslint-disable-line no-undef
|
|
375
|
-
chai.request(app)
|
|
376
|
-
.head('/v1/list/resource/test_service_resource')
|
|
377
|
-
.set('x-auth-token', alltokens.scopedtoken.tenant0)
|
|
378
|
-
.end(function(err, res){
|
|
379
|
-
expect(res).to.have.status(204);
|
|
380
|
-
expect(res.body).to.be.empty;
|
|
381
|
-
done();
|
|
382
|
-
});
|
|
383
|
-
});
|
|
384
|
-
|
|
385
|
-
// 7. HEAD /v1/list/policy HTTP/1.1
|
|
386
|
-
it('HEAD /v1/list/policy with status 204', function(done){ // eslint-disable-line no-undef
|
|
387
|
-
chai.request(app)
|
|
388
|
-
.head('/v1/list/policy')
|
|
389
|
-
.set('x-auth-token', alltokens.scopedtoken.tenant0)
|
|
390
|
-
.end(function(err, res){
|
|
391
|
-
expect(res).to.have.status(204);
|
|
392
|
-
expect(res.body).to.be.empty;
|
|
393
|
-
done();
|
|
394
|
-
});
|
|
395
|
-
});
|
|
396
|
-
// 7.1 HEAD /v1/list/policy/acr-policy HTTP/1.1
|
|
397
|
-
it('HEAD /v1/list/policy/acr-policy with status 204', function(done){ // eslint-disable-line no-undef
|
|
398
|
-
chai.request(app)
|
|
399
|
-
.head('/v1/list/policy/acr-policy')
|
|
400
|
-
.set('x-auth-token', alltokens.scopedtoken.tenant0)
|
|
401
|
-
.end(function(err, res){
|
|
402
|
-
expect(res).to.have.status(204);
|
|
403
|
-
expect(res.body).to.be.empty;
|
|
404
|
-
done();
|
|
405
|
-
});
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
// 8. HEAD /v1/list/role HTTP/1.1
|
|
409
|
-
it('HEAD /v1/list/role with status 204', function(done){ // eslint-disable-line no-undef
|
|
410
|
-
chai.request(app)
|
|
411
|
-
.head('/v1/list/role')
|
|
412
|
-
.set('x-auth-token', alltokens.scopedtoken.tenant0)
|
|
413
|
-
.end(function(err, res){
|
|
414
|
-
expect(res).to.have.status(204);
|
|
415
|
-
expect(res.body).to.be.empty;
|
|
416
|
-
done();
|
|
417
|
-
});
|
|
418
|
-
});
|
|
419
|
-
// 8.1 HEAD /v1/list/role/acr-role HTTP/1.1
|
|
420
|
-
it('HEAD /v1/list/role/acr-role with status 204', function(done){ // eslint-disable-line no-undef
|
|
421
|
-
chai.request(app)
|
|
422
|
-
.head('/v1/list/role/acr-role')
|
|
423
|
-
.set('x-auth-token', alltokens.scopedtoken.tenant0)
|
|
424
|
-
.end(function(err, res){
|
|
425
|
-
expect(res).to.have.status(204);
|
|
426
|
-
expect(res.body).to.be.empty;
|
|
427
|
-
done();
|
|
428
|
-
});
|
|
429
|
-
});
|
|
430
|
-
});
|
|
431
|
-
|
|
432
|
-
/*
|
|
433
|
-
* Local variables:
|
|
434
|
-
* tab-width: 4
|
|
435
|
-
* c-basic-offset: 4
|
|
436
|
-
* End:
|
|
437
|
-
* vim600: noexpandtab sw=4 ts=4 fdm=marker
|
|
438
|
-
* vim<600: noexpandtab sw=4 ts=4
|
|
439
|
-
*/
|
package/tests/auto_list_spec.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* K2HR3 REST API
|
|
3
|
-
*
|
|
4
|
-
* Copyright 2017 Yahoo Japan Corporation.
|
|
5
|
-
*
|
|
6
|
-
* K2HR3 is K2hdkc based Resource and Roles and policy Rules, gathers
|
|
7
|
-
* common management information for the cloud.
|
|
8
|
-
* K2HR3 can dynamically manage information as "who", "what", "operate".
|
|
9
|
-
* These are stored as roles, resources, policies in K2hdkc, and the
|
|
10
|
-
* client system can dynamically read and modify these information.
|
|
11
|
-
*
|
|
12
|
-
* For the full copyright and license information, please view
|
|
13
|
-
* the license file that was distributed with this source code.
|
|
14
|
-
*
|
|
15
|
-
* AUTHOR: Takeshi Nakatani
|
|
16
|
-
* CREATE: Tue Dec 19 2017
|
|
17
|
-
* REVISION:
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
'use strict';
|
|
22
|
-
|
|
23
|
-
var common = require('./auto_common'); // Common objects for Chai
|
|
24
|
-
var chai = common.chai; // eslint-disable-line no-unused-vars
|
|
25
|
-
var chaiHttp = common.chaiHttp; // eslint-disable-line no-unused-vars
|
|
26
|
-
var app = common.app; // eslint-disable-line no-unused-vars
|
|
27
|
-
var assert = common.assert; // eslint-disable-line no-unused-vars
|
|
28
|
-
var expect = common.expect; // eslint-disable-line no-unused-vars
|
|
29
|
-
var subproc = require('./auto_subprocesses');
|
|
30
|
-
|
|
31
|
-
//--------------------------------------------------------------
|
|
32
|
-
// Before in global section
|
|
33
|
-
//--------------------------------------------------------------
|
|
34
|
-
before(function(){ // eslint-disable-line no-undef
|
|
35
|
-
//
|
|
36
|
-
// Start all sub processes
|
|
37
|
-
//
|
|
38
|
-
subproc.start(this);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
//--------------------------------------------------------------
|
|
42
|
-
// After in global section
|
|
43
|
-
//--------------------------------------------------------------
|
|
44
|
-
after(function(){ // eslint-disable-line no-undef
|
|
45
|
-
//
|
|
46
|
-
// Stop all sub processes
|
|
47
|
-
//
|
|
48
|
-
subproc.stop(this);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
//--------------------------------------------------------------
|
|
52
|
-
// BeforeEach in global section
|
|
53
|
-
//--------------------------------------------------------------
|
|
54
|
-
beforeEach(function(){ // eslint-disable-line no-undef
|
|
55
|
-
// Nothing to do
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
//--------------------------------------------------------------
|
|
59
|
-
// AfterEach in global section
|
|
60
|
-
//--------------------------------------------------------------
|
|
61
|
-
afterEach(function(){ // eslint-disable-line no-undef
|
|
62
|
-
// Nothing to do
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
//--------------------------------------------------------------
|
|
66
|
-
// Sub describe section
|
|
67
|
-
//--------------------------------------------------------------
|
|
68
|
-
describe('SUB API TEST: LIST', function(){ // eslint-disable-line no-undef
|
|
69
|
-
require('./auto_list');
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
/*
|
|
73
|
-
* Local variables:
|
|
74
|
-
* tab-width: 4
|
|
75
|
-
* c-basic-offset: 4
|
|
76
|
-
* End:
|
|
77
|
-
* vim600: noexpandtab sw=4 ts=4 fdm=marker
|
|
78
|
-
* vim<600: noexpandtab sw=4 ts=4
|
|
79
|
-
*/
|