Produced by Araxis Merge on 10/4/2017 8:04:35 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | rdk.zip\rdk\product\production\rdk\src\resources\permission-sets | get-user-permission-sets-spec.js | Mon Aug 21 12:51:07 2017 UTC |
| 2 | rdk.zip\rdk\product\production\rdk\src\resources\permission-sets | get-user-permission-sets-spec.js | Tue Oct 3 18:22:17 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 8 | 224 |
| Changed | 7 | 18 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | 'use stric t'; | |
| 2 | ||
| 3 | var _ = re quire('lod ash'); | |
| 4 | var nock = require(' nock'); | |
| 5 | var httpMo cks = requ ire('node- mocks-http '); | |
| 6 | var getUse rPermissio nSets = re quire('./g et-user-pe rmission-s ets'); | |
| 7 | var logger = sinon.s tub(requir e('bunyan' ).createLo gger({ | |
| 8 | name: 'get-user- permission -sets' | |
| 9 | })); | |
| 10 | var subjec tUser = { | |
| 11 | uid: 'urn: va:user: REDACTED :0007', | |
| 12 | permis sionSet: { | |
| 13 | ad ditionalPe rmissions: [ | |
| 14 | 'judo-ch op', | |
| 15 | 'can-yod el' | |
| 16 | ], | |
| 17 | modifiedBy : 'urn:va: user: REDACTED :0001', | |
| 18 | mo difiedOn: '2017-03-1 4T13:59:26 Z', | |
| 19 | va l: [ | |
| 20 | 'read-ac cess', | |
| 21 | 'sumo-wr estler', | |
| 22 | 'potty-t rained' | |
| 23 | ] | |
| 24 | }, | |
| 25 | status : 'active' | |
| 26 | }; | |
| 27 | var permis sionSets = { | |
| 28 | items: [{ | |
| 29 | 'u id': 'sumo -wrestler' , | |
| 30 | 'l abel': 'Su mo Wrestle r', | |
| 31 | 'p ermissions ': ['not-t o-be-trifl ed-with'], | |
| 32 | 's tatus': 'a ctive' | |
| 33 | }, { | |
| 34 | 'u id': 'read -access', | |
| 35 | 'l abel': 'Re ad Access' , | |
| 36 | 'p ermissions ': ['i-can -has-read' ], | |
| 37 | 's tatus': 'a ctive' | |
| 38 | }] | |
| 39 | }; | |
| 40 | var permis sions = { | |
| 41 | items: [{ | |
| 42 | 'u id': 'not- to-be-trif led-with', | |
| 43 | 'l abel': 'Se riously, d on\'t trif le', | |
| 44 | 's tatus': 'a ctive' | |
| 45 | }, { | |
| 46 | 'u id': 'i-ca n-has-read ', | |
| 47 | 'l abel': 'Pa ssed 1st g rade after 3rd try', | |
| 48 | 's tatus': 'a ctive' | |
| 49 | }, { | |
| 50 | 'u id': 'add- fridge-sti cker', | |
| 51 | 'l abel': 'Ce lebrate Po tty Time w ith Sticke rs!', | |
| 52 | 's tatus': 'a ctive' | |
| 53 | }, { | |
| 54 | 'u id': 'judo -chop', | |
| 55 | 'l abel': 'Ju do CHOP', | |
| 56 | 'd escription ': 'Downwa rd chop to the upwar d facing a ir', | |
| 57 | 's tatus': 'a ctive' | |
| 58 | }] | |
| 59 | }; | |
| 60 | ||
| 61 | describe(' Get User P ermission Sets', fun ction() { | |
| 62 | var re q; | |
| 63 | var re s; | |
| 64 | ||
| 65 | before Each(funct ion(done) { | |
| 66 | re q = httpMo cks.create Request({ | |
| 67 | method: 'PUT', | |
| 68 | url: 're source/per mission-se ts/getUser Permission Sets' | |
| 69 | }) ; | |
| 70 | _. set(req, ' app.config .generalPu rposeJdsSe rver', { | |
| 71 | baseUrl: ' http:// IP ', | |
| 72 | urlLengt hLimit: 12 0 | |
| 73 | }) ; | |
| 74 | _. set(req, ' audit', {} ); | |
| 75 | _. set(req, ' logger', l ogger); | |
| 76 | _. set(req, ' query.uid' , subjectU ser.uid); | |
| 77 | re s = httpMo cks.create Response() ; | |
| 78 | re s.rdkSend = function (result) {}; | |
| 79 | ||
| 80 | nock('http :// IP ') | |
| 81 | .get('/p ermset/?fi lter=eq(%2 2status%22 %2C%22acti ve%22)') | |
| 82 | .reply(2 00, permis sionSets); | |
| 83 | nock('http :// IP ') | |
| 84 | .get('/p ermission/ ?filter=eq (%22status %22%2C%22a ctive%22)' ) | |
| 85 | .reply(2 00, permis sions); | |
| 86 | do ne(); | |
| 87 | }); | |
| 88 | ||
| 89 | afterE ach(functi on(done) { | |
| 90 | no ck.cleanAl l(); | |
| 91 | do ne(); | |
| 92 | }); | |
| 93 | ||
| 94 | it('re turns the permission sets of a specific user', fun ction(done ) { | |
| 95 | nock('http :// IP ') | |
| 96 | .get('/ehm pusers/urn :va:user: REDACTED :0007') | |
| 97 | .reply(2 00, subjec tUser); | |
| 98 | re s.rdkSend = function (response) { | |
| 99 | expect(_ .get(respo nse, 'val' , []).inde xOf('sumo- wrestler') , 'sumo-wr estler sho uld be a l isted valu e').to.be. above(-1); | |
| 100 | expect(_ .get(respo nse, 'val' , []).inde xOf('read- access'), 'read-acce ss should be a liste d value'). to.be.abov e(-1); | |
| 101 | expect(_ .get(respo nse, 'val' , []).inde xOf('potty -trained') , 'potty-t rained is deprecated and shoul d not be l isted').to .be(-1); | |
| 102 | expect(_ .get(respo nse, 'addi tionalPerm issions', []).indexO f('judo-ch op'), 'jud o-chop sho uld be a l isted addi tionalPerm issions'). to.be.abov e(-1); | |
| 103 | expect(_ .get(respo nse, 'addi tionalPerm issions', []).indexO f('can-yod el'), 'can -yodel is deprecated and shoul d not be l isted').to .be(-1); | |
| 104 | done(); | |
| 105 | }; | |
| 106 | ||
| 107 | ge tUserPermi ssionSets( req, res); | |
| 108 | }); | |
| 109 | ||
| 110 | it('re turns the an error m essage if a problem occurs at the store' , function (done) { | |
| 111 | nock('http :// IP ') | |
| 112 | .get('/ehm pusers/urn :va:user: REDACTED :0007') | |
| 113 | .reply(4 04, new Er ror('Nothi ng there a t this add ress')); | |
| 114 | re s.rdkSend = function (response) { | |
| 115 | expect(r esponse, ' The respon se should have an Er ror messag e').to.mat ch(/Error/ ); | |
| 116 | done(); | |
| 117 | }; | |
| 118 | ||
| 119 | ge tUserPermi ssionSets( req, res); | |
| 120 | }); | |
| 121 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.