Ignore:
Timestamp:
Jul 9, 2012, 7:43:46 PM (12 years ago)
Author:
Sam Habiel
Message:

Added/fixed the following:

  • Unit Tests for running everything through PIMS
  • Checks for end of message for error handling ((31))
  • All routines previously using transactions use locks now
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Scheduling/trunk/m/BSDXUT2.m

    r1472 r1479  
    1 BSDXUT2 ; VEN/SMH - Unit Tests for Scheduling GUI - cont. ; 7/5/12 11:39am
     1BSDXUT2 ; VEN/SMH - Unit Tests for Scheduling GUI - cont. ; 7/9/12 3:18pm
    22        ;;1.7T1;BSDX;;Jul 06, 2012;Build 18
    33        ;
    44EN      ; Run all unit tests in this routine
    5         D UT25
     5        D UT25,PIMS
    66        QUIT
    77        ;
     
    177177        IF +^BSDXTMP($J,1)'=-100 WRITE "ERROR IN Etest 7",!
    178178        K BSDXDIE
    179         ;
    180         ; Tests for running PIMS by itself.
     179        QUIT
     180        ;
     181PIMS ; Tests for running PIMS by itself.
     182        N $ET S $ET="W ""An Error Occured. Breaking."",! BREAK"
     183        N RESNAM S RESNAM="UTCLINIC"
     184        N HLRESIENS ; holds output of UTCR^BSDXUT - HL IEN^Resource IEN
     185        D
     186        . N $ET S $ET="D ^%ZTER B"
     187        . S HLRESIENS=$$UTCR^BSDXUT(RESNAM)
     188        . I HLRESIENS<0 S $EC=",U1," ; not supposed to happen - hard crash if so
     189        ;
     190        N HLIEN,RESIEN
     191        S HLIEN=$P(HLRESIENS,U)
     192        S RESIEN=$P(HLRESIENS,U,2)
     193        ;
     194        ;
    181195        N APPTTIME S APPTTIME=$$TIMEHL^BSDXUT(HLIEN) ; appt time
    182196        N DFN S DFN=2
     197        ;
     198        ; TEST $$MAKE1^BSDXAPI
    183199        N % S %=$$MAKE1^BSDXAPI(DFN,HLIEN,3,APPTTIME,15,"Sam Test Appt"_DFN)
    184200        I % W "Error in $$MAKE1^BSDXAPI for TIME "_APPTTIME_" for DFN "_DFN,!,%,!
    185201        I '$D(^BSDXAPPT("APAT",DFN,APPTTIME)) W "No BSDX Appointment Created",!
    186         ;TODO: Index doesn't include resource.
    187         N APPTID S APPTID=$O(^(APPTTIME,""))
     202        N RESID S RESID=$O(^(APPTTIME,""))
     203        N APPTID S APPTID=$O(^(RESID,""))
    188204        I 'APPTID W "Can't get appointment",!
    189205        IF $P(^BSDXAPPT(APPTID,0),U,3) WRITE "ERROR IN CHECKIN 3",!
     206        ;
     207        ; TEST CHECKIN1 AND RMCI ^BSDXAPI[1]
    190208        N % S %=$$CHECKIN1^BSDXAPI(DFN,HLIEN,APPTTIME) ; Checkin via PIMS
    191209        I % W "Error in Checking in via BSDXAPI",!
     
    200218        IF '+$G(^SC(HLIEN,"S",APPTTIME,1,1,"C")) WRITE "ERROR IN CHECKIN 14",!
    201219        IF '$P(^BSDXAPPT(APPTID,0),U,3) WRITE "ERROR IN CHECKIN 15",!
     220        ;
     221        ; TEST CANCEL1^BSDXAPI
     222        N APPTTIME S APPTTIME=$$TIMEHL^BSDXUT(HLIEN) ; appt time
     223        N DFN S DFN=2
     224        N % S %=$$MAKE1^BSDXAPI(DFN,HLIEN,3,APPTTIME,15,"Sam Test Appt"_DFN)
     225        I % W "Error in $$MAKE1^BSDXAPI for TIME "_APPTTIME_" for DFN "_DFN,!,%,!
     226        I '$D(^BSDXAPPT("APAT",DFN,APPTTIME)) W "No BSDX Appointment Created",!
     227        N RESID S RESID=$O(^(APPTTIME,""))
     228        N APPTID S APPTID=$O(^(RESID,""))
     229        I 'APPTID W "Can't get appointment",!
     230        N % S %=$$CANCEL1^BSDXAPI(DFN,HLIEN,"PC",APPTTIME,1,"Afraid of Baby Foxes")
     231        I % W "Error cancelling via $$CANCEL1^BSDXAPI",!
     232        I ^BSDXAPPT(APPTID,0) ; Change $R
     233        I '$P(^(0),U,12) W "No cancel date found in BSDXAPPT",!
     234        ; Make same appointment again!
     235        ; NB: Index APAT will have two identical entries, one for the cancelled
     236        ; appointment, and one for the new one. I won't check it for that reason.
     237        N % S %=$$MAKE1^BSDXAPI(DFN,HLIEN,3,APPTTIME,15,"Sam Test Appt"_DFN)
     238        I % W "Error in $$MAKE1^BSDXAPI for TIME "_APPTTIME_" for DFN "_DFN,!,%,!
     239        ;
     240        ; TEST NOSHOW^BSDXAPI1
     241        N APPTTIME S APPTTIME=$$TIMEHL^BSDXUT(HLIEN) ; appt time
     242        N DFN S DFN=3
     243        N % S %=$$MAKE1^BSDXAPI(DFN,HLIEN,3,APPTTIME,15,"Sam Test Appt"_DFN)
     244        I % W "Error in $$MAKE1^BSDXAPI for TIME "_APPTTIME_" for DFN "_DFN,!,%,!
     245        I '$D(^BSDXAPPT("APAT",DFN,APPTTIME)) W "No BSDX Appointment Created",!
     246        N RESID S RESID=$O(^(APPTTIME,""))
     247        N APPTID S APPTID=$O(^(RESID,""))
     248        I 'APPTID W "Can't get appointment",!
     249        ; No show via PIMS
     250        N % S %=$$NOSHOW^BSDXAPI1(DFN,HLIEN,APPTTIME,1)
     251        I % W "Error no-showing via $$NOSHOW^BSDXAPI1",!
     252        I ^BSDXAPPT(APPTID,0) ; Change $R
     253        I '$P(^(0),U,10) W "No-show not present in ^BSDXAPPT",!
     254        ; un-noshow via PIMS
     255        N % S %=$$NOSHOW^BSDXAPI1(DFN,HLIEN,APPTTIME,0)
     256        I % W "Error no-showing via $$NOSHOW^BSDXAPI1",!
     257        I ^BSDXAPPT(APPTID,0) ; Change $R
     258        I $P(^(0),U,10) W "No-show present in ^BSDXAPPT when it shouldn't",!
     259        ;
     260        ; NB: UPDATENT^BSDXAPI is updates the note. Right now, we don't have any
     261        ; way to update the note from BSDXAPI back to ^BSDXAPPT as the protocol
     262        ; file is currently not involved. Right now I can't even find the code
     263        ; that lets you change an appointment note in PIMS.
     264        ;
    202265        QUIT
Note: See TracChangeset for help on using the changeset viewer.