Skip to content

Commit 2d617fa

Browse files
committed
renamed kuzzleProfile.js -> Profile.js
1 parent 6752500 commit 2d617fa

File tree

5 files changed

+59
-59
lines changed

5 files changed

+59
-59
lines changed
File renamed without changes.

src/security/Security.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var
22
Role = require('./kuzzleRole'),
3-
Profile = require('./kuzzleProfile'),
3+
Profile = require('./Profile'),
44
User = require('./kuzzleUser');
55

66
/**

test/security/kuzzleProfile/constructor.test.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var
33
bluebird = require('bluebird'),
44
rewire = require('rewire'),
55
Kuzzle = rewire('../../../src/Kuzzle'),
6-
Profile = require('../../../src/security/kuzzleProfile');
6+
Profile = require('../../../src/security/Profile');
77

88
describe('Profile constructor', function () {
99
var
@@ -31,36 +31,36 @@ describe('Profile constructor', function () {
3131

3232
it('should initialize properties and return a valid Profile object', function () {
3333
var
34-
kuzzleProfile;
34+
profile;
3535

3636
kuzzle = new Kuzzle('foo');
37-
kuzzleProfile = new Profile(kuzzle.security, 'id', {some: 'content'});
37+
profile = new Profile(kuzzle.security, 'id', {some: 'content'});
3838

39-
should(kuzzleProfile).be.instanceof(Profile);
40-
should(kuzzleProfile).have.propertyWithDescriptor('deleteActionName', { enumerable: false, writable: false, configurable: false });
41-
should(kuzzleProfile.deleteActionName).be.exactly('deleteProfile');
39+
should(profile).be.instanceof(Profile);
40+
should(profile).have.propertyWithDescriptor('deleteActionName', { enumerable: false, writable: false, configurable: false });
41+
should(profile.deleteActionName).be.exactly('deleteProfile');
4242
});
4343

4444
it('should expose functions', function () {
45-
var kuzzleProfile = new Profile(kuzzle.security, 'test', {});
45+
var profile = new Profile(kuzzle.security, 'test', {});
4646

47-
should.exist(kuzzleProfile.save);
48-
should.exist(kuzzleProfile.addPolicy);
49-
should.exist(kuzzleProfile.savePromise);
50-
should.exist(kuzzleProfile.setPolicies);
51-
should.exist(kuzzleProfile.deletePromise);
52-
should.exist(kuzzleProfile.serialize);
47+
should.exist(profile.save);
48+
should.exist(profile.addPolicy);
49+
should.exist(profile.savePromise);
50+
should.exist(profile.setPolicies);
51+
should.exist(profile.deletePromise);
52+
should.exist(profile.serialize);
5353
});
5454

5555
it('should handle provided arguments correctly', function () {
56-
var kuzzleProfile = new Profile(kuzzle.security, 'test', {});
56+
var profile = new Profile(kuzzle.security, 'test', {});
5757

58-
should(kuzzleProfile).be.instanceof(Profile);
59-
should(kuzzleProfile.id).be.exactly('test');
60-
should(kuzzleProfile.content).be.empty();
58+
should(profile).be.instanceof(Profile);
59+
should(profile.id).be.exactly('test');
60+
should(profile.content).be.empty();
6161

62-
kuzzleProfile = new Profile(kuzzle.security, 'test', {some: 'content'});
63-
should(kuzzleProfile.id).be.exactly('test');
64-
should(kuzzleProfile.content).match({some: 'content'});
62+
profile = new Profile(kuzzle.security, 'test', {some: 'content'});
63+
should(profile.id).be.exactly('test');
64+
should(profile.content).match({some: 'content'});
6565
});
6666
});

test/security/kuzzleProfile/methods.test.js

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
var
22
should = require('should'),
33
Kuzzle = require('../../../src/Kuzzle'),
4-
Profile = require('../../../src/security/kuzzleProfile'),
4+
Profile = require('../../../src/security/Profile'),
55
Role = require('../../../src/security/kuzzleRole');
66

77
describe('Profile methods', function () {
88
var
99
kuzzle,
10-
kuzzleProfile,
10+
profile,
1111
result,
1212
expectedQuery,
1313
error = null,
@@ -49,18 +49,18 @@ describe('Profile methods', function () {
4949
error = null;
5050

5151
result = { result: {_id: 'myProfile', _source: {policies : []}} };
52-
kuzzleProfile = new Profile(kuzzle.security, result.result._id, result.result._source);
52+
profile = new Profile(kuzzle.security, result.result._id, result.result._source);
5353
expectedQuery = {
5454
action: 'createOrReplaceProfile',
5555
controller: 'security'
5656
};
5757
});
5858

5959
it('should throw an error if the profile has not roles parameter', function (done) {
60-
kuzzleProfile = new Profile(kuzzle.security, result.result._id, {some: 'content'});
60+
profile = new Profile(kuzzle.security, result.result._id, {some: 'content'});
6161

6262
should((function () {
63-
kuzzleProfile.save();
63+
profile.save();
6464
})).throw(Error);
6565

6666
done();
@@ -70,7 +70,7 @@ describe('Profile methods', function () {
7070
expectedQuery.body = result.result._source;
7171
expectedQuery._id = result.result._id;
7272

73-
should(kuzzleProfile.save(function (err, res) {
73+
should(profile.save(function (err, res) {
7474
should(err).be.null();
7575
should(res).be.instanceof(Profile);
7676
done();
@@ -83,7 +83,7 @@ describe('Profile methods', function () {
8383
error = 'foobar';
8484
this.timeout(50);
8585

86-
kuzzleProfile.save(function (err, res) {
86+
profile.save(function (err, res) {
8787
should(err).be.exactly('foobar');
8888
should(res).be.undefined();
8989
done();
@@ -109,7 +109,7 @@ describe('Profile methods', function () {
109109
expectedQuery.body = {'foo': 'bar'};
110110
expectedQuery._id = result.result._id;
111111

112-
should(kuzzleProfile.update({'foo': 'bar'}, function (err, res) {
112+
should(profile.update({'foo': 'bar'}, function (err, res) {
113113
should(err).be.null();
114114
should(res).be.instanceof(Profile);
115115
done();
@@ -123,7 +123,7 @@ describe('Profile methods', function () {
123123
error = 'foobar';
124124
this.timeout(50);
125125

126-
kuzzleProfile.update({'foo': 'bar'}, function (err, res) {
126+
profile.update({'foo': 'bar'}, function (err, res) {
127127
should(err).be.exactly('foobar');
128128
should(res).be.undefined();
129129
done();
@@ -137,7 +137,7 @@ describe('Profile methods', function () {
137137
this.timeout(50);
138138

139139
try {
140-
kuzzleProfile.update();
140+
profile.update();
141141
}
142142
catch (e) {
143143
should(e).be.instanceOf(Error);
@@ -149,86 +149,86 @@ describe('Profile methods', function () {
149149
describe('#addPolicy', function () {
150150
beforeEach(function () {
151151
kuzzle = new Kuzzle('http://localhost:7512');
152-
kuzzleProfile = new Profile(kuzzle.security, 'myProfile', {policies: [{roleId:'role1'}]});
152+
profile = new Profile(kuzzle.security, 'myProfile', {policies: [{roleId:'role1'}]});
153153
});
154154

155155
it('should throw an error if the policy parameter is not an object', function (done) {
156156
should((function () {
157-
kuzzleProfile.addPolicy(null);
157+
profile.addPolicy(null);
158158
})).throw(Error);
159159

160160
done();
161161
});
162162

163163
it('should throw an error if the policy.roleId parameter is not a string', function (done) {
164164
should((function () {
165-
kuzzleProfile.addPolicy({roleId: null});
165+
profile.addPolicy({roleId: null});
166166
})).throw(Error);
167167

168168
done();
169169
});
170170

171171
it('should add the right policy in policies list', function (done) {
172-
kuzzleProfile.addPolicy({roleId: 'role2'});
173-
should(kuzzleProfile.content.policies).be.an.Array().match([{roleId: 'role1'}, {roleId: 'role2'}]);
174-
should(kuzzleProfile.content.policies.length).be.exactly(2);
172+
profile.addPolicy({roleId: 'role2'});
173+
should(profile.content.policies).be.an.Array().match([{roleId: 'role1'}, {roleId: 'role2'}]);
174+
should(profile.content.policies.length).be.exactly(2);
175175
done();
176176
});
177177

178178
it('should initialize policies with array if no policy was set before', function (done) {
179-
kuzzleProfile = new Profile(kuzzle.security, 'myProfile', {some: 'content'});
179+
profile = new Profile(kuzzle.security, 'myProfile', {some: 'content'});
180180

181-
kuzzleProfile.addPolicy({roleId: 'role'});
182-
should(kuzzleProfile.content.policies).be.an.Array();
183-
should(kuzzleProfile.content.policies.length).be.exactly(1);
181+
profile.addPolicy({roleId: 'role'});
182+
should(profile.content.policies).be.an.Array();
183+
should(profile.content.policies.length).be.exactly(1);
184184
done();
185185
});
186186
});
187187

188188
describe('#setPolicies', function () {
189189
beforeEach(function () {
190190
kuzzle = new Kuzzle('http://localhost:7512');
191-
kuzzleProfile = new Profile(kuzzle.security, 'myProfile', {policies: [{roleId:'role1'}]});
191+
profile = new Profile(kuzzle.security, 'myProfile', {policies: [{roleId:'role1'}]});
192192
});
193193

194194
it('should throw an error if the policies parameter is null', function (done) {
195195
should((function () {
196-
kuzzleProfile.setPolicies(null);
196+
profile.setPolicies(null);
197197
})).throw(Error);
198198

199199
done();
200200
});
201201

202202
it('should throw an error if the role parameter is not a array of objects', function (done) {
203203
should((function () {
204-
kuzzleProfile.setPolicies([1, 2, 3]);
204+
profile.setPolicies([1, 2, 3]);
205205
})).throw(Error);
206206

207207
done();
208208
});
209209

210210
it('should add the policy in policies list', function (done) {
211-
kuzzleProfile.setPolicies([{roleId:'role2'}]);
212-
should(kuzzleProfile.content.policies).be.an.Array().match([{roleId:'role2'}]);
211+
profile.setPolicies([{roleId:'role2'}]);
212+
should(profile.content.policies).be.an.Array().match([{roleId:'role2'}]);
213213
done();
214214
});
215215

216216
it('should add the Role in roles list', function (done) {
217-
kuzzleProfile.setPolicies([{roleId:'role1'}, {roleId:'role2'}]);
218-
should(kuzzleProfile.content.policies).be.an.Array();
219-
should(kuzzleProfile.content.policies.length).be.exactly(2);
217+
profile.setPolicies([{roleId:'role1'}, {roleId:'role2'}]);
218+
should(profile.content.policies).be.an.Array();
219+
should(profile.content.policies.length).be.exactly(2);
220220
done();
221221
});
222222
});
223223

224224
describe('#serialize', function () {
225225
beforeEach(function () {
226226
kuzzle = new Kuzzle('http://localhost:7512');
227-
kuzzleProfile = new Profile(kuzzle.security, 'myProfile', {some: 'content', policies: [{roleId:'role1'}]});
227+
profile = new Profile(kuzzle.security, 'myProfile', {some: 'content', policies: [{roleId:'role1'}]});
228228
});
229229

230230
it('should serialize with correct attributes', function (done) {
231-
var serialized = kuzzleProfile.serialize();
231+
var serialized = profile.serialize();
232232

233233
should(serialized._id).be.exactly('myProfile');
234234
should(serialized.body).be.match({some: 'content', policies: [{roleId:'role1'}]});
@@ -239,9 +239,9 @@ describe('Profile methods', function () {
239239
var
240240
serialized;
241241

242-
kuzzleProfile = new Profile(kuzzle.security, 'myProfile', {some: 'content'});
242+
profile = new Profile(kuzzle.security, 'myProfile', {some: 'content'});
243243

244-
serialized = kuzzleProfile.serialize();
244+
serialized = profile.serialize();
245245

246246
should(serialized._id).be.exactly('myProfile');
247247
should.exist(serialized.body.some);
@@ -257,7 +257,7 @@ describe('Profile methods', function () {
257257
error = null;
258258

259259
result = { result: {_id: 'myProfile'} };
260-
kuzzleProfile = new Profile(kuzzle.security, 'myProfile', {some: 'content', roles: [{roleId:'role1'}]});
260+
profile = new Profile(kuzzle.security, 'myProfile', {some: 'content', roles: [{roleId:'role1'}]});
261261
expectedQuery = {
262262
action: 'deleteProfile',
263263
controller: 'security'
@@ -268,7 +268,7 @@ describe('Profile methods', function () {
268268
expectedQuery.body = result.result._source;
269269
expectedQuery._id = result.result._id;
270270

271-
should(kuzzleProfile.delete(function (err, res) {
271+
should(profile.delete(function (err, res) {
272272
should(err).be.null();
273273
should(res).be.exactly(result.result._id);
274274
done();
@@ -281,7 +281,7 @@ describe('Profile methods', function () {
281281

282282
error = 'foobar';
283283

284-
kuzzleProfile.delete(function (err, res) {
284+
profile.delete(function (err, res) {
285285
should(err).be.exactly('foobar');
286286
should(res).be.undefined();
287287
done();
@@ -294,8 +294,8 @@ describe('Profile methods', function () {
294294
var policies = [{roleId:'role1'}, {roleId:'role2'}, {roleId:'role3'}];
295295

296296
kuzzle = new Kuzzle('http://localhost:7512');
297-
kuzzleProfile = new Profile(kuzzle.security, 'myProfile', {some: 'content', policies: policies});
298-
should(kuzzleProfile.getPolicies()).be.eql(policies);
297+
profile = new Profile(kuzzle.security, 'myProfile', {some: 'content', policies: policies});
298+
should(profile.getPolicies()).be.eql(policies);
299299
});
300300
});
301301
});

test/security/kuzzleSecurity/profilesMethods.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var
22
should = require('should'),
33
Kuzzle = require('../../../src/Kuzzle'),
4-
Profile = require('../../../src/security/kuzzleProfile');
4+
Profile = require('../../../src/security/Profile');
55

66
describe('Security profiles methods', function () {
77
var

0 commit comments

Comments
 (0)