Produced by Araxis Merge on 10/3/2017 11:15:12 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 | ehmp.zip\ehmp\ehmp\product\production\jds\src\vpr | VPRJTSES.m | Mon Jul 10 17:46:22 2017 UTC |
| 2 | ehmp.zip\ehmp\ehmp\product\production\jds\src\vpr | VPRJTSES.m | Mon Oct 2 19:46:30 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 682 |
| 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 | VPRJTSOD ; KRM/CJE -- Unit Test s for GET/ PUT/DELETE session D ata | |
| 2 | ;;1.0;JSO N DATA STO RE;;Jan 27 , 2015 | |
| 3 | ; | |
| 4 | ; Endpoin ts tested | |
| 5 | ;POST/PUT session/s et/this SE T^VPRJSES | |
| 6 | ;GET sess ion/get/{_ id} GET^VP RJSES | |
| 7 | ;GET sess ion/length /this LEN^ VPRJSES | |
| 8 | ;DELETE s ession/des troy/{_id} DEL^VPRJS ES | |
| 9 | ;GET sess ion/destro y/{_id} DE L^VPRJSES | |
| 10 | ;DELETE s ession/cle ar/this CL R^VPRJSES | |
| 11 | ;GET sess ion/clear/ this CLR^V PRJSES | |
| 12 | STARTUP ; Run once before all tests | |
| 13 | Q | |
| 14 | SHUTDOWN ; Run once after all tests | |
| 15 | Q | |
| 16 | ASSERT(EXP ECT,ACTUAL ,MSG) ; fo r convenie nce | |
| 17 | D EQ^VPRJ T(EXPECT,A CTUAL,$G(M SG)) | |
| 18 | Q | |
| 19 | ; | |
| 20 | SITEOD(SIT E,KEY,VALU E) ; Setup Session D ata JSON f or set | |
| 21 | Q "{""_id "": """_SI TE_""",""" _KEY_""": """_VALUE_ """}" | |
| 22 | SETJSONERR ;; @TEST Error code is set if JSON is m angled in PUT/POST | |
| 23 | N RETURN, BODY,ARG,H TTPERR | |
| 24 | ; Create bad JSON | |
| 25 | S BODY(1) =$$SITEOD( "ZZUT","la stUpdate", "20150127- 1000") | |
| 26 | S BODY(1) =BODY(1)_" :" | |
| 27 | ; Send it to the UR L | |
| 28 | S RETURN= $$SET^VPRJ SES(.ARG,. BODY) | |
| 29 | D ASSERT( 0,$D(^VPRJ SES("ZZUT" )),"A Sess ion Data e xists and it should not") | |
| 30 | D ASSERT( 400,$G(^|| TMP("HTTPE RR",$J,1," error","co de")),"An HTTP 400 e rror shoul d have occ ured") | |
| 31 | D ASSERT( 202,$G(^|| TMP("HTTPE RR",$J,1," error","er rors",1,"r eason"))," An 202 rea son code s hould have occurred" ) | |
| 32 | ; Cleanup HTTPERR | |
| 33 | K ^||TMP( "HTTPERR", $J) | |
| 34 | Q | |
| 35 | SETIDRR ;; @TEST Err or code is set if no ID | |
| 36 | N RETURN, BODY,ARG,H TTPERR | |
| 37 | ; Try wit h a null _ id field | |
| 38 | S BODY(1) =$$SITEOD( "","lastUp date","201 50127-1000 ") | |
| 39 | S RETURN= $$SET^VPRJ SES(.ARG,. BODY) | |
| 40 | D ASSERT( 0,$D(^VPRJ SES("ZZUT" )),"A Sess ion Data e xists and it should not") | |
| 41 | D ASSERT( 404,$G(^|| TMP("HTTPE RR",$J,1," error","co de")),"An HTTP 404 e rror shoul d have occ ured") | |
| 42 | D ASSERT( 220,$G(^|| TMP("HTTPE RR",$J,1," error","er rors",1,"r eason"))," An 220 rea son code s hould have occurred" ) | |
| 43 | ; Cleanup HTTPERR | |
| 44 | K ^||TMP( "HTTPERR", $J) | |
| 45 | ; Cleanup Vars | |
| 46 | K BODY,RE TURN,ARG | |
| 47 | ; Try wit h a non ex istant _id field | |
| 48 | S BODY(1) ="{""ZZUT" ": ""20150 127-1000"" }" | |
| 49 | S RETURN= $$SET^VPRJ SES(.ARG,. BODY) | |
| 50 | D ASSERT( 0,$D(^VPRJ SES("ZZUT" )),"A Sess ion Data e xists and it should not") | |
| 51 | D ASSERT( 404,$G(^|| TMP("HTTPE RR",$J,1," error","co de")),"An HTTP 404 e rror shoul d have occ ured") | |
| 52 | D ASSERT( 220,$G(^|| TMP("HTTPE RR",$J,1," error","er rors",1,"r eason"))," An 220 rea son code s hould have occurred" ) | |
| 53 | ; Cleanup HTTPERR | |
| 54 | K ^||TMP( "HTTPERR", $J) | |
| 55 | Q | |
| 56 | SET1 ;; @T EST Store one Sessio n Data | |
| 57 | N RETURN, BODY,ARG,H TTPERR | |
| 58 | S BODY(1) =$$SITEOD( "ZZUT","la stUpdate", "20150127- 1000") | |
| 59 | S RETURN= $$SET^VPRJ SES(.ARG,. BODY) | |
| 60 | D ASSERT( 10,$D(^VPR JSES("ZZUT ")),"A Ses sion Data does not e xist and i t should") | |
| 61 | D ASSERT( 0,$D(^||TM P("HTTPERR ",$J,1,"er ror","code ")),"An HT TP error s hould NOT have occur ed") | |
| 62 | D ASSERT( "ZZUT",$G( ^VPRJSES(" ZZUT","_id ")),"The _ id field w as not sto red correc tly") | |
| 63 | D ASSERT( "20150127- 1000",$G(^ VPRJSES("Z ZUT","last Update")), "The lastU pdate fiel d was not stored cor rectly") | |
| 64 | ; Cleanup HTTPERR | |
| 65 | K ^||TMP( "HTTPERR", $J) | |
| 66 | ; Cleanup ^VPRJSES | |
| 67 | K ^VPRJSE S("ZZUT") | |
| 68 | I $G(^VPR JSES(0))>0 S ^VPRJSE S(0)=^VPRJ SES(0)-1 | |
| 69 | Q | |
| 70 | SET2 ;; @T EST Store two Sessio n Data | |
| 71 | N RETURN, BODY,ARG,H TTPERR | |
| 72 | S BODY(1) =$$SITEOD( "ZZUT","la stUpdate", "20150127- 1000") | |
| 73 | S RETURN= $$SET^VPRJ SES(.ARG,. BODY) | |
| 74 | D ASSERT( 10,$D(^VPR JSES("ZZUT ")),"A Ses sion Data does not e xist and i t should") | |
| 75 | D ASSERT( 0,$D(^||TM P("HTTPERR ",$J,1,"er ror","code ")),"An HT TP error s hould NOT have occur ed") | |
| 76 | D ASSERT( "ZZUT",$G( ^VPRJSES(" ZZUT","_id ")),"The _ id field w as not sto red correc tly") | |
| 77 | D ASSERT( "20150127- 1000",$G(^ VPRJSES("Z ZUT","last Update")), "The lastU pdate fiel d was not stored cor rectly") | |
| 78 | ; Cleanup HTTPERR | |
| 79 | K ^||TMP( "HTTPERR", $J) | |
| 80 | ; Cleanup Vars | |
| 81 | K RETURN, BODY,ARG | |
| 82 | ; Run it again with a new las tUpdate ti me | |
| 83 | S BODY(1) =$$SITEOD( "ZZUT","la stUpdate", "20150127- 1500") | |
| 84 | S RETURN= $$SET^VPRJ SES(.ARG,. BODY) | |
| 85 | D ASSERT( 10,$D(^VPR JSES("ZZUT ")),"A Ses sion Data does not e xist and i t should") | |
| 86 | D ASSERT( 0,$D(^||TM P("HTTPERR ",$J,1,"er ror","code ")),"An HT TP error s hould NOT have occur ed") | |
| 87 | D ASSERT( "ZZUT",$G( ^VPRJSES(" ZZUT","_id ")),"The _ id field w as not sto red correc tly") | |
| 88 | D ASSERT( "20150127- 1500",$G(^ VPRJSES("Z ZUT","last Update")), "The lastU pdate fiel d was not stored cor rectly") | |
| 89 | ; Cleanup HTTPERR | |
| 90 | K ^||TMP( "HTTPERR", $J) | |
| 91 | ; Cleanup Vars | |
| 92 | K RETURN, BODY,ARG | |
| 93 | ; Run it again with a new las tUpdate ti me that is smaller | |
| 94 | S BODY(1) =$$SITEOD( "ZZUT","la stUpdate", "20150127- 25") | |
| 95 | S RETURN= $$SET^VPRJ SES(.ARG,. BODY) | |
| 96 | D ASSERT( 10,$D(^VPR JSES("ZZUT ")),"A Ses sion Data does not e xist and i t should") | |
| 97 | D ASSERT( 0,$D(^||TM P("HTTPERR ",$J,1,"er ror","code ")),"An HT TP error s hould NOT have occur ed") | |
| 98 | D ASSERT( "ZZUT",$G( ^VPRJSES(" ZZUT","_id ")),"The _ id field w as not sto red correc tly") | |
| 99 | D ASSERT( "20150127- 25",$G(^VP RJSES("ZZU T","lastUp date")),"T he lastUpd ate field was not st ored corre ctly") | |
| 100 | ; Cleanup HTTPERR | |
| 101 | K ^||TMP( "HTTPERR", $J) | |
| 102 | ; Cleanup ^VPRJSES | |
| 103 | K ^VPRJSE S("ZZUT") | |
| 104 | I $G(^VPR JSES(0))>0 S ^VPRJSE S(0)=^VPRJ SES(0)-3 | |
| 105 | Q | |
| 106 | DELIDERR ; ; @TEST Er ror code i s set if n o Id | |
| 107 | N DATA,OB JECT,ERR,A RGS,HTTPER R | |
| 108 | ; Try wit h a non ex istant _id | |
| 109 | D DEL^VPR JSES(.DATA ,.ARGS) | |
| 110 | D ASSERT( 0,$D(^VPRJ SES("ZZUT" )),"A Sess ion Data e xists and it should not") | |
| 111 | D ASSERT( 0,$D(DATA) ,"No DATA should be returned") | |
| 112 | D ASSERT( 400,$G(^|| TMP("HTTPE RR",$J,1," error","co de")),"An HTTP 400 e rror shoul d have occ ured") | |
| 113 | D ASSERT( 111,$G(^|| TMP("HTTPE RR",$J,1," error","er rors",1,"r eason"))," An 111 rea son code s hould have occurred" ) | |
| 114 | ; Cleanup HTTPERR | |
| 115 | K ^||TMP( "HTTPERR", $J) | |
| 116 | ; Cleanup vars | |
| 117 | K DATA,OB JECT,ERR,A RGS | |
| 118 | ; Try wit h a blank _id | |
| 119 | S ARGS("_ id")="" | |
| 120 | D DEL^VPR JSES(.DATA ,.ARGS) | |
| 121 | D ASSERT( 0,$D(^VPRJ SES("ZZUT" )),"A Sess ion Data e xists and it should not") | |
| 122 | D ASSERT( 0,$D(DATA) ,"No DATA should be returned") | |
| 123 | D ASSERT( 400,$G(^|| TMP("HTTPE RR",$J,1," error","co de")),"An HTTP 400 e rror shoul d have occ ured") | |
| 124 | D ASSERT( 111,$G(^|| TMP("HTTPE RR",$J,1," error","er rors",1,"r eason"))," An 111 rea son code s hould have occurred" ) | |
| 125 | ; Cleanup HTTPERR | |
| 126 | K ^||TMP( "HTTPERR", $J) | |
| 127 | Q | |
| 128 | DEL ;; @TE ST Delete Session Da ta | |
| 129 | N RETURN, BODY,ARG,D ATA,ARGS,O BJECT,ERR, HTTPERR | |
| 130 | ; Create Session Da ta | |
| 131 | S BODY(1) =$$SITEOD( "ZZUT","la stUpdate", "20150127- 1000") | |
| 132 | S RETURN= $$SET^VPRJ SES(.ARG,. BODY) | |
| 133 | D ASSERT( 10,$D(^VPR JSES("ZZUT ")),"A Ses sion Data does not e xist and i t should") | |
| 134 | D ASSERT( 0,$D(^||TM P("HTTPERR ",$J,1,"er ror","code ")),"An HT TP error s hould NOT have occur ed") | |
| 135 | D ASSERT( "ZZUT",$G( ^VPRJSES(" ZZUT","_id ")),"The _ id field w as not sto red correc tly") | |
| 136 | D ASSERT( "20150127- 1000",$G(^ VPRJSES("Z ZUT","last Update")), "The lastU pdate fiel d was not stored cor rectly") | |
| 137 | ; Cleanup HTTPERR | |
| 138 | K ^||TMP( "HTTPERR", $J) | |
| 139 | ; Cleanup Vars | |
| 140 | K BODY,RE TURN,ARG | |
| 141 | ; Now del ete it | |
| 142 | S ARGS("_ id")="ZZUT " | |
| 143 | D DEL^VPR JSES(.DATA ,.ARGS) | |
| 144 | D DECODE^ VPRJSON("D ATA","OBJE CT","ERR") | |
| 145 | D ASSERT( 0,$D(^VPRJ SES("ZZUT" )),"A Sess ion Data e xists and it should not") | |
| 146 | D ASSERT( "{}",$G(DA TA),"DATA returned f rom a DELE TE call (s hould not happen)") | |
| 147 | ; Cleanup HTTPERR | |
| 148 | K ^||TMP( "HTTPERR", $J) | |
| 149 | Q | |
| 150 | LEN ;; @TE ST Get num ber of Ses sion Data | |
| 151 | N RETURN, BODY,ARG,D ATA,ARGS,O BJECT,ERR, HTTPERR | |
| 152 | ; Create Session Da ta | |
| 153 | S BODY(1) =$$SITEOD( "ZZUT","la stUpdate", "20150127- 1000") | |
| 154 | S RETURN= $$SET^VPRJ SES(.ARG,. BODY) | |
| 155 | D ASSERT( 10,$D(^VPR JSES("ZZUT ")),"A Ses sion Data does not e xist and i t should") | |
| 156 | D ASSERT( 0,$D(^||TM P("HTTPERR ",$J,1,"er ror","code ")),"An HT TP error s hould NOT have occur ed") | |
| 157 | D ASSERT( "ZZUT",$G( ^VPRJSES(" ZZUT","_id ")),"The _ id field w as not sto red correc tly") | |
| 158 | D ASSERT( "20150127- 1000",$G(^ VPRJSES("Z ZUT","last Update")), "The lastU pdate fiel d was not stored cor rectly") | |
| 159 | ; Cleanup HTTPERR | |
| 160 | K ^||TMP( "HTTPERR", $J) | |
| 161 | ; Cleanup Vars | |
| 162 | K BODY,RE TURN,ARG | |
| 163 | ; Now get length | |
| 164 | D LEN^VPR JSES(.DATA ,.ARGS) | |
| 165 | D DECODE^ VPRJSON("D ATA","OBJE CT","ERR") | |
| 166 | D ASSERT( 0,$D(^||TM P("HTTPERR ",$J)),"An HTTP Erro r Occured" ) | |
| 167 | D ASSERT( 0,$D(ERR), "A JSON De code Error Occured") | |
| 168 | D ASSERT( 1,$G(OBJEC T("length" )),"The to tal number of object s doesn't match1") | |
| 169 | ; Cleanup HTTPERR | |
| 170 | K ^||TMP( "HTTPERR", $J) | |
| 171 | ; Cleanup Vars | |
| 172 | K OBJECT, DATA,ERR,A RGS | |
| 173 | ; Create Session Da ta | |
| 174 | S BODY(1) =$$SITEOD( "ZZUT1","l astUpdate" ,"20150127 -1000") | |
| 175 | S RETURN= $$SET^VPRJ SES(.ARG,. BODY) | |
| 176 | D ASSERT( 10,$D(^VPR JSES("ZZUT ")),"A Ses sion Data does not e xist and i t should") | |
| 177 | D ASSERT( 0,$D(^||TM P("HTTPERR ",$J,1,"er ror","code ")),"An HT TP error s hould NOT have occur ed") | |
| 178 | D ASSERT( "ZZUT",$G( ^VPRJSES(" ZZUT","_id ")),"The _ id field w as not sto red correc tly") | |
| 179 | D ASSERT( "20150127- 1000",$G(^ VPRJSES("Z ZUT","last Update")), "The lastU pdate fiel d was not stored cor rectly") | |
| 180 | ; Cleanup HTTPERR | |
| 181 | K ^||TMP( "HTTPERR", $J) | |
| 182 | ; Cleanup Vars | |
| 183 | K BODY,RE TURN,ARG | |
| 184 | ; Now get length | |
| 185 | D LEN^VPR JSES(.DATA ,.ARGS) | |
| 186 | D DECODE^ VPRJSON("D ATA","OBJE CT","ERR") | |
| 187 | D ASSERT( 0,$D(^||TM P("HTTPERR ",$J)),"An HTTP Erro r Occured" ) | |
| 188 | D ASSERT( 0,$D(ERR), "A JSON De code Error Occured") | |
| 189 | D ASSERT( 2,$G(OBJEC T("length" )),"The to tal number of object s doesn't match2") | |
| 190 | ; Cleanup HTTPERR | |
| 191 | K ^||TMP( "HTTPERR", $J) | |
| 192 | ; Cleanup ^VPRJSES | |
| 193 | K ^VPRJSE S("ZZUT") | |
| 194 | K ^VPRJSE S("ZZUT1") | |
| 195 | I $G(^VPR JSES(0))>0 S ^VPRJSE S(0)=^VPRJ SES(0)-2 | |
| 196 | Q | |
| 197 | GETIDERR ; ; @TEST Er ror code i s set if n o Id | |
| 198 | N DATA,AR GS,OBJECT, HTTPERR | |
| 199 | ; Try wit h a non ex istant _id attribute | |
| 200 | D GET^VPR JSES(.DATA ,.ARGS) | |
| 201 | D ASSERT( 0,$D(^VPRJ SES("ZZUT" )),"A Sess ion Data e xists and it should not") | |
| 202 | D ASSERT( 0,$D(DATA) ,"No DATA should be returned") | |
| 203 | D ASSERT( 400,$G(^|| TMP("HTTPE RR",$J,1," error","co de")),"An HTTP 400 e rror shoul d have occ ured") | |
| 204 | D ASSERT( 111,$G(^|| TMP("HTTPE RR",$J,1," error","er rors",1,"r eason"))," An 111 rea son code s hould have occurred" ) | |
| 205 | ; Cleanup HTTPERR | |
| 206 | K ^||TMP( "HTTPERR", $J) | |
| 207 | ; Cleanup Vars | |
| 208 | K DATA,OB JECT,ARGS | |
| 209 | ; Try wit h a null i d | |
| 210 | S ARGS("_ id")="" | |
| 211 | D GET^VPR JSES(.DATA ,.ARGS) | |
| 212 | D ASSERT( 0,$D(^VPRJ SES("ZZUT" )),"A Sess ion Data e xists and it should not") | |
| 213 | D ASSERT( 0,$D(DATA) ,"No DATA should be returned") | |
| 214 | D ASSERT( 400,$G(^|| TMP("HTTPE RR",$J,1," error","co de")),"An HTTP 400 e rror shoul d have occ ured") | |
| 215 | D ASSERT( 111,$G(^|| TMP("HTTPE RR",$J,1," error","er rors",1,"r eason"))," An 111 rea son code s hould have occurred" ) | |
| 216 | ; Cleanup HTTPERR | |
| 217 | K ^||TMP( "HTTPERR", $J) | |
| 218 | Q | |
| 219 | GETJSONERR ;; Error code is se t if encod ing to JSO N fails | |
| 220 | N DATA,AR GS,OBJECT, HTTPERR | |
| 221 | S ARGS("_ id")="ZZUT " | |
| 222 | D GET^VPR JSES(.DATA ,.ARGS) | |
| 223 | D ASSERT( 0,$D(DATA) ,"No DATA should be returned") | |
| 224 | D ASSERT( 400,$G(^|| TMP("HTTPE RR",$J,1," error","co de")),"An HTTP 400 e rror shoul d have occ ured") | |
| 225 | D ASSERT( 202,$G(^|| TMP("HTTPE RR",$J,1," error","er rors",1,"r eason"))," An 202 rea son code s hould have occurred" ) | |
| 226 | ; Cleanup HTTPERR | |
| 227 | K ^||TMP( "HTTPERR", $J) | |
| 228 | Q | |
| 229 | GET ;; @TE ST Get Ses sion Data | |
| 230 | N RETURN, ARG,BODY,D ATA,ARGS,O BJECT,ERR, HTTPERR | |
| 231 | ; Create Session Da ta | |
| 232 | S BODY(1) =$$SITEOD( "ZZUT","la stUpdate", "20150127- 1000") | |
| 233 | S RETURN= $$SET^VPRJ SES(.ARG,. BODY) | |
| 234 | D ASSERT( 10,$D(^VPR JSES("ZZUT ")),"Sessi on Data do es not exi st and it should") | |
| 235 | D ASSERT( 0,$D(^||TM P("HTTPERR ",$J,1,"er ror","code ")),"An HT TP error s hould NOT have occur ed") | |
| 236 | D ASSERT( "ZZUT",$G( ^VPRJSES(" ZZUT","_id ")),"The _ id field w as not sto red correc tly") | |
| 237 | D ASSERT( "20150127- 1000",$G(^ VPRJSES("Z ZUT","last Update")), "The lastU pdate fiel d was not stored cor rectly") | |
| 238 | ; Cleanup HTTPERR | |
| 239 | K ^||TMP( "HTTPERR", $J) | |
| 240 | ; Cleanup Vars | |
| 241 | K RETURN, ARG,BODY | |
| 242 | ; Get the data we s tored | |
| 243 | S ARGS("_ id")="ZZUT " | |
| 244 | D GET^VPR JSES(.DATA ,.ARGS) | |
| 245 | D DECODE^ VPRJSON("D ATA","OBJE CT","ERR") | |
| 246 | D ASSERT( 10,$D(^VPR JSES("ZZUT ")),"Sessi on Data do es not exi st and it should") | |
| 247 | D ASSERT( 0,$D(ERR), "A JSON De code Error Occured") | |
| 248 | D ASSERT( 0,$D(^||TM P("HTTPERR ",$J,1,"er ror")),"An HTTP erro r should N OT have oc cured") | |
| 249 | D ASSERT( "ZZUT",$G( OBJECT("_i d")),"retu rned data for the wr ong _id") | |
| 250 | D ASSERT( "20150127- 1000",$G(O BJECT("las tUpdate")) ,"returned data for lastUpdate didn't ma tch") | |
| 251 | ; Cleanup HTTPERR | |
| 252 | K ^||TMP( "HTTPERR", $J) | |
| 253 | ; Cleanup Vars | |
| 254 | K DATA,AR GS,OBJECT, ERR | |
| 255 | ; Create Session Da ta update | |
| 256 | S BODY(1) =$$SITEOD( "ZZUT","la stUpdate", "20150127- 1500") | |
| 257 | S RETURN= $$SET^VPRJ SES(.ARG,. BODY) | |
| 258 | D ASSERT( 10,$D(^VPR JSES("ZZUT ")),"Sessi on Data do es not exi st and it should") | |
| 259 | D ASSERT( 0,$D(^||TM P("HTTPERR ",$J,1,"er ror")),"An HTTP erro r should N OT have oc cured") | |
| 260 | D ASSERT( "ZZUT",$G( ^VPRJSES(" ZZUT","_id ")),"The _ id field w as not sto red correc tly") | |
| 261 | D ASSERT( "20150127- 1500",$G(^ VPRJSES("Z ZUT","last Update")), "The lastU pdate fiel d was not stored cor rectly") | |
| 262 | ; Cleanup HTTPERR | |
| 263 | K ^||TMP( "HTTPERR", $J) | |
| 264 | ; Cleanup Vars | |
| 265 | K RETURN, ARG,BODY | |
| 266 | ; Get the data we s tored upda te | |
| 267 | S ARGS("_ id")="ZZUT " | |
| 268 | D GET^VPR JSES(.DATA ,.ARGS) | |
| 269 | D DECODE^ VPRJSON("D ATA","OBJE CT","ERR") | |
| 270 | D ASSERT( 10,$D(^VPR JSES("ZZUT ")),"Sessi on Data do es not exi st and it should") | |
| 271 | D ASSERT( 0,$D(ERR), "A JSON De code Error Occured") | |
| 272 | D ASSERT( 0,$D(^||TM P("HTTPERR ",$J,1,"er ror")),"An HTTP erro r should N OT have oc cured") | |
| 273 | D ASSERT( "ZZUT",$G( OBJECT("_i d")),"retu rned data for the wr ong _id") | |
| 274 | D ASSERT( "20150127- 1500",$G(O BJECT("las tUpdate")) ,"returned data for lastUpdate didn't ma tch") | |
| 275 | ; Cleanup HTTPERR | |
| 276 | K ^||TMP( "HTTPERR", $J) | |
| 277 | ; Cleanup Vars | |
| 278 | K DATA,AR GS,OBJECT, ERR | |
| 279 | ; Create second Ses sion Data | |
| 280 | S BODY(1) =$$SITEOD( "ZZUT1","l astUpdate" ,"20150127 -1000") | |
| 281 | S RETURN= $$SET^VPRJ SES(.ARG,. BODY) | |
| 282 | D ASSERT( 10,$D(^VPR JSES("ZZUT 1")),"Sess ion Data d oes not ex ist and it should") | |
| 283 | D ASSERT( 0,$D(^||TM P("HTTPERR ",$J,1,"er ror")),"An HTTP erro r should N OT have oc cured") | |
| 284 | D ASSERT( "ZZUT1",$G (^VPRJSES( "ZZUT1","_ id")),"The _id field was not s tored corr ectly") | |
| 285 | D ASSERT( "20150127- 1000",$G(^ VPRJSES("Z ZUT1","las tUpdate")) ,"The last Update fie ld was not stored co rrectly") | |
| 286 | ; Cleanup HTTPERR | |
| 287 | K ^||TMP( "HTTPERR", $J) | |
| 288 | ; Cleanup Vars | |
| 289 | K RETURN, ARG,BODY | |
| 290 | ; Get sec ond Sessio n Data | |
| 291 | S ARGS("_ id")="ZZUT 1" | |
| 292 | D GET^VPR JSES(.DATA ,.ARGS) | |
| 293 | D DECODE^ VPRJSON("D ATA","OBJE CT","ERR") | |
| 294 | D ASSERT( 10,$D(^VPR JSES("ZZUT 1")),"Sess ion Data d oes not ex ists and i t should") | |
| 295 | D ASSERT( 0,$D(ERR), "A JSON De code Error Occured") | |
| 296 | D ASSERT( 0,$D(^||TM P("HTTPERR ",$J,1,"er ror")),"An HTTP erro r should N OT have oc cured") | |
| 297 | D ASSERT( "ZZUT1",$G (OBJECT("_ id")),"ret urned data for the w rong _id") | |
| 298 | D ASSERT( "20150127- 1000",$G(O BJECT("las tUpdate")) ,"returned data for lastUpdate didn't ma tch") | |
| 299 | ; Cleanup HTTPERR | |
| 300 | K ^||TMP( "HTTPERR", $J) | |
| 301 | ; leave t hese aroun d so they can be kil led in the next test | |
| 302 | Q | |
| 303 | CLR ;; @TE ST Clear A LL Session Data | |
| 304 | N RETURN, BODY,ARG,D ATA,ARGS,O BJECT,ERR, HTTPERR | |
| 305 | D CLR^VPR JSES(.DATA ,.ARGS) | |
| 306 | D DECODE^ VPRJSON("D ATA","OBJE CT","ERR") | |
| 307 | D ASSERT( 0,$D(^VPRJ SES("ZZUT" )),"A Sess ion Data e xists and it should not") | |
| 308 | D ASSERT( "{}",$G(DA TA),"DATA returned f rom a DELE TE call (s hould not happen)") | |
| 309 | D ASSERT( 10,$D(^VPR JSES),"Glo bal not cl eared") | |
| 310 | ; Cleanup HTTPERR | |
| 311 | K ^||TMP( "HTTPERR", $J) | |
| 312 | Q | |
| 313 | REAL ;; @T EST with r ealistic d ata | |
| 314 | N RETURN, ARG,BODY,D ATA,ARGS,O BJECT,ERR, HTTPERR | |
| 315 | ; Create Session Da ta | |
| 316 | S BODY(1) ="{""_id"" :""ebTxc-5 Zqn6qup8LG wf4deTrJRG Iw1y4"","" session"": {""cookie" ":{""origi nalMaxAge" ":900000," "expires"" :""2015-01 -30T04:38: 30.084Z"", ""httpOnly "":true,"" path"":""/ ""},""user "":{""acce ssCode"":" " REDACT "",""verif yCode"":"" REDACTED "",""usern ame"":"" PW "",""passw ord"":"" REDACTED "",""first name"":""P ANORAMA"", ""lastname "":""USER" ",""facili ty"":""PAN ORAMA"","" vistaKeys" ":[""XUPRO G"",""PROV IDER"",""G MRA-SUPERV ISOR"",""O RES"",""GM RC101"","" XUPROGMODE "",""GMV M ANAGER""," "PSB CPRS MED BUTTON ""],""titl e"":""Clin ician"","" section"": ""Medicine "",""disab led"":fals e,""requir esReset"": false,""di visionSele ct"":false ,""dgRecor dAccess"": ""false"", ""dgSensit iveAccess" ":""false" ",""dgSecu rityOffice r"":""fals e"",""duz" ":{""9E7A" ":""100000 00226""}," "site"":"" 9E7A"",""s sn"":""666 441233""," "corsTabs" ":""true"" ,""rptTabs "":""false "",""permi ssions"":[ ""edit-pat ient-recor d"",""add- patient-al lergy"","" remove-pat ient-aller gy"",""add -patient-v ital"",""r emove-pati ent-vital" ",""add-pa tient-med" ",""edit-p atient-med "",""remov e-patient- med"",""ad d-patient- problem"", ""edit-pat ient-probl em"",""rem ove-patien t-problem" ",""add-pa tient-labo rder"",""e dit-patien t-laborder "",""remov e-patient- laborder"" ,""add-pat ient-radio logy"",""e dit-patien t-radiolog y"",""remo ve-patient -radiology "",""patie nt-visit"" ,""add-pat ient-order "",""add-p atient-imm unization" ",""edit-p atient-dem ographics" "]}},""exp ires"":""2 015-01-30T 04:38:30.0 84Z""}" | |
| 317 | S RETURN= $$SET^VPRJ SES(.ARG,. BODY) | |
| 318 | D ASSERT( 10,$D(^VPR JSES("ebTx c-5Zqn6qup 8LGwf4deTr JRGIw1y4") ),"Session Data does not exist and it sh ould") | |
| 319 | D ASSERT( 0,$D(^||TM P("HTTPERR ",$J,1,"er ror","code ")),"An HT TP error s hould NOT have occur ed") | |
| 320 | D ASSERT( "ebTxc-5Zq n6qup8LGwf 4deTrJRGIw 1y4",$G(^V PRJSES("eb Txc-5Zqn6q up8LGwf4de TrJRGIw1y4 ","_id")), "The _id f ield was n ot stored correctly" ) | |
| 321 | D ASSERT( "900000",$ G(^VPRJSES ("ebTxc-5Z qn6qup8LGw f4deTrJRGI w1y4","ses sion","coo kie","orig inalMaxAge ")),"retur ned data f or sessin cookie ori ginalMaxAg e didn't m atch") | |
| 322 | D ASSERT( "100000002 26",$G(^VP RJSES("ebT xc-5Zqn6qu p8LGwf4deT rJRGIw1y4" ,"session" ,"user","d uz","9E7A" )),"The us er duz 9E7 A field wa s not stor ed correct ly") | |
| 323 | D ASSERT( "XUPROG",$ G(^VPRJSES ("ebTxc-5Z qn6qup8LGw f4deTrJRGI w1y4","ses sion","use r","vistaK eys",1))," The user v istaKeys a rray was n ot stored correctly" ) | |
| 324 | ; Cleanup HTTPERR | |
| 325 | K ^||TMP( "HTTPERR", $J) | |
| 326 | ; Cleanup Vars | |
| 327 | K RETURN, ARG,BODY | |
| 328 | ; Get the data we s tored | |
| 329 | S ARGS("_ id")="ebTx c-5Zqn6qup 8LGwf4deTr JRGIw1y4" | |
| 330 | D GET^VPR JSES(.DATA ,.ARGS) | |
| 331 | D DECODE^ VPRJSON("D ATA","OBJE CT","ERR") | |
| 332 | D ASSERT( 10,$D(^VPR JSES("ebTx c-5Zqn6qup 8LGwf4deTr JRGIw1y4") ),"Session Data does not exist and it sh ould") | |
| 333 | D ASSERT( 0,$D(ERR), "A JSON De code Error Occured") | |
| 334 | D ASSERT( 0,$D(^||TM P("HTTPERR ",$J,1,"er ror")),"An HTTP erro r should N OT have oc cured") | |
| 335 | D ASSERT( "ebTxc-5Zq n6qup8LGwf 4deTrJRGIw 1y4",$G(OB JECT("_id" )),"return ed data fo r the wron g _id") | |
| 336 | D ASSERT( "900000",$ G(OBJECT(" session"," cookie","o riginalMax Age")),"re turned dat a for sess in cookie originalMa xAge didn' t match") | |
| 337 | D ASSERT( "100000002 26",$G(OBJ ECT("sessi on","user" ,"duz","9E 7A")),"The user duz 9E7A field was not s tored corr ectly") | |
| 338 | D ASSERT( "XUPROG",$ G(OBJECT(" session"," user","vis taKeys",1) ),"The use r vistaKey s array wa s not stor ed correct ly") | |
| 339 | ; Cleanup HTTPERR | |
| 340 | K ^||TMP( "HTTPERR", $J) | |
| 341 | D CLR^VPR JSES(.DATA ,.ARGS) | |
| 342 | Q |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.