Produced by Araxis Merge on 10/4/2017 8:04:36 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\subsystems\pep | pep-subsystem-itest-spec.js | Mon Aug 21 12:51:00 2017 UTC |
| 2 | rdk.zip\rdk\product\production\rdk\src\subsystems\pep | pep-subsystem-itest-spec.js | Tue Oct 3 17:18:39 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 252 |
| Changed | 1 | 2 |
| 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 httpMo cks = requ ire('node- mocks-http '); | |
| 4 | var pepFac tory = req uire('./pe p-handler- factory'); | |
| 5 | var pepSub system = r equire('./ pep-subsys tem'); | |
| 6 | ||
| 7 | describe(' When pep s ubsystem i s called', function( ) { | |
| 8 | var re q, res, ca llback, mo ckPolicyHa ndler, moc kPermissio nHandler; | |
| 9 | ||
| 10 | before Each(funct ion(done) { | |
| 11 | re q = { | |
| 12 | intercep torResults : { | |
| 13 | pati entIdentif iers: { | |
| 14 | originalID : '' | |
| 15 | } | |
| 16 | }, | |
| 17 | logger: {}, | |
| 18 | audit: { | |
| 19 | sens itive: fal se | |
| 20 | }, | |
| 21 | app: { | |
| 22 | conf ig: { | |
| 23 | jdsServer: { | |
| 24 | 'baseURL': 'http:// IP ' | |
| 25 | } | |
| 26 | } | |
| 27 | } | |
| 28 | }; | |
| 29 | re q._resourc eConfigIte m = { | |
| 30 | isPatien tCentric: false, | |
| 31 | required Permission s: [] | |
| 32 | }; | |
| 33 | re q.session = { | |
| 34 | user: { | |
| 35 | perm issionSets : [{ | |
| 36 | label: 'Re ad Access' , | |
| 37 | val: 'read -access' | |
| 38 | }], | |
| 39 | perm issions: [ 'read-gene ric-permis sion'] | |
| 40 | } | |
| 41 | }; | |
| 42 | re q.logger.i nfo = func tion(){}; | |
| 43 | re q.logger.e rror = fun ction(){}; | |
| 44 | re q.logger.d ebug = fun ction(){}; | |
| 45 | ||
| 46 | ca llback = s inon.spy() ; | |
| 47 | re s = httpMo cks.create Response() ; | |
| 48 | ||
| 49 | ||
| 50 | mo ckPolicyHa ndler = si non.spy(pe pFactory.h andlers.po licy, 'han dler'); | |
| 51 | ||
| 52 | mo ckPermissi onHandler = sinon.sp y(pepFacto ry.handler s.permissi on, 'handl er'); | |
| 53 | ||
| 54 | do ne(); | |
| 55 | }); | |
| 56 | ||
| 57 | afterE ach(functi on(done) { | |
| 58 | ||
| 59 | do ne(); | |
| 60 | }); | |
| 61 | ||
| 62 | it('wi th patient centric fa lse and re quiredPerm issions em pty the po licy and p ermissions handlers are skippe d', functi on(done) { | |
| 63 | pe pSubsystem .execute(r eq, res, c allback); | |
| 64 | ||
| 65 | ex pect(mockP olicyHandl er.callCou nt).to.be( 0); | |
| 66 | ex pect(mockP ermissionH andler.cal lCount).to .be(0); | |
| 67 | ex pect(callb ack.callCo unt).to.be (1); | |
| 68 | ||
| 69 | do ne(); | |
| 70 | }); | |
| 71 | ||
| 72 | it('wi th patient centric tr ue and req uiredPermi ssions emp ty the pol icy handle r is run a nd permiss ions handl er is skip ped', func tion(done) { | |
| 73 | re q._resourc eConfigIte m.isPatien tCentric = true; | |
| 74 | re q.intercep torResults .patientId entifiers. originalID = '9E7A;1 0'; | |
| 75 | ||
| 76 | pe pSubsystem .execute(r eq, res, c allback); | |
| 77 | ||
| 78 | ex pect(mockP olicyHandl er.callCou nt).to.be( 1); | |
| 79 | ex pect(mockP ermissionH andler.cal lCount).to .be(0); | |
| 80 | ex pect(callb ack.callCo unt).to.be (1); | |
| 81 | ||
| 82 | do ne(); | |
| 83 | }); | |
| 84 | ||
| 85 | it('wi th patient centric fa lse and re quiredPerm issions no t empty th e policy h andler is skipped an d permissi ons handle r is run', function( done) { | |
| 86 | re q._resourc eConfigIte m.required Permission s = ['read -generic-p ermission' ]; | |
| 87 | ||
| 88 | pe pSubsystem .execute(r eq, res, c allback); | |
| 89 | ||
| 90 | ex pect(mockP olicyHandl er.callCou nt).to.be( 0); | |
| 91 | ex pect(mockP ermissionH andler.cal lCount).to .be(1); | |
| 92 | ex pect(callb ack.callCo unt).to.be (1); | |
| 93 | ||
| 94 | do ne(); | |
| 95 | }); | |
| 96 | ||
| 97 | it('wi th patient centric tr ue and req uiredPermi ssions not empty the policy an d permissi ons handle rs are run ', functio n(done) { | |
| 98 | re q._resourc eConfigIte m.isPatien tCentric = true; | |
| 99 | re q.intercep torResults .patientId entifiers. originalID = '9E7A;1 0'; | |
| 100 | re q._resourc eConfigIte m.required Permission s = ['read -generic-p ermission' ]; | |
| 101 | ||
| 102 | pe pSubsystem .execute(r eq, res, c allback); | |
| 103 | ||
| 104 | ex pect(mockP olicyHandl er.callCou nt).to.be( 1); | |
| 105 | ex pect(mockP ermissionH andler.cal lCount).to .be(1); | |
| 106 | ex pect(callb ack.callCo unt).to.be (1); | |
| 107 | ||
| 108 | do ne(); | |
| 109 | }); | |
| 110 | ||
| 111 | it('wi th policy and permis sion handl ers and pe rmission h andler cal ls back wi th an erro r', functi on(done) { | |
| 112 | re q._resourc eConfigIte m.isPatien tCentric = true; | |
| 113 | re q.intercep torResults .patientId entifiers. originalID = '9E7A;1 0'; | |
| 114 | re q._resourc eConfigIte m.required Permission s = ['read -explicit- permission ']; | |
| 115 | ||
| 116 | pe pSubsystem .execute(r eq, res, c allback); | |
| 117 | ||
| 118 | va r args = c allback.ge tCall(0).a rgs; | |
| 119 | ||
| 120 | ex pect(mockP olicyHandl er.callCou nt).to.be( 1); | |
| 121 | ex pect(mockP ermissionH andler.cal lCount).to .be(1); | |
| 122 | ex pect(callb ack.callCo unt).to.be (1); | |
| 123 | ex pect(args[ 0]).should .be.an('ob ject'); | |
| 124 | ||
| 125 | do ne(); | |
| 126 | }); | |
| 127 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.