mirror of
https://github.com/sasjs/core.git
synced 2026-01-07 17:40:05 +00:00
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
@file
|
||||
@brief Testing mcf_stpsrv_header macro
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mcf_stpsrv_header.sas
|
||||
@li mp_assert.sas
|
||||
|
||||
**/
|
||||
|
||||
%let sasjs_stpsrv_header_loc=%sysfunc(pathname(work))/stpsrv_header.txt;
|
||||
|
||||
%mcf_stpsrv_header(wrap=YES, insert_cmplib=YES)
|
||||
|
||||
data _null_;
|
||||
rc=stpsrv_header('Content-type','application/text');
|
||||
rc=stpsrv_header('Content-disposition',"attachment; filename=file.txt");
|
||||
run;
|
||||
|
||||
%let test1=FAIL;
|
||||
%let test2=FAIL;
|
||||
|
||||
data _null_;
|
||||
infile "&sasjs_stpsrv_header_loc";
|
||||
input;
|
||||
if _n_=1 and _infile_='Content-type: application/text'
|
||||
then call symputx('test1','PASS');
|
||||
else if _n_=2 & _infile_='Content-disposition: attachment; filename=file.txt'
|
||||
then call symputx('test2','PASS');
|
||||
run;
|
||||
|
||||
%mp_assert(
|
||||
iftrue=(%str(&test1)=%str(PASS)),
|
||||
desc=Check first header line
|
||||
)
|
||||
%mp_assert(
|
||||
iftrue=(%str(&test2)=%str(PASS)),
|
||||
desc=Check second header line
|
||||
)
|
||||
@@ -8,6 +8,13 @@
|
||||
|
||||
**/
|
||||
|
||||
|
||||
%macro gsubtest();
|
||||
%if "%substr(&sysver,1,4)"="V.04" %then %do;
|
||||
%put %str(ERR)OR: Viya 4 does not support the IO library in lua;
|
||||
%return;
|
||||
%end;
|
||||
|
||||
/**
|
||||
* test 1 - simple replace
|
||||
*/
|
||||
@@ -63,4 +70,8 @@ run;
|
||||
iftrue=("&strcheck2b"="&str2"),
|
||||
desc=Check that multi line replacement was successful (line3),
|
||||
outds=work.test_results
|
||||
)
|
||||
)
|
||||
|
||||
%mend gsubtest;
|
||||
|
||||
%gsubtest()
|
||||
|
||||
52
tests/viyaonly/mv_deleteviyafolder.test.sas
Normal file
52
tests/viyaonly/mv_deleteviyafolder.test.sas
Normal file
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
@file
|
||||
@brief Testing mv_deleteviyafolder macro function
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mf_uid.sas
|
||||
@li mfv_existfolder.sas
|
||||
@li mp_assert.sas
|
||||
@li mp_assertscope.sas
|
||||
@li mv_createfolder.sas
|
||||
@li mv_deleteviyafolder.sas
|
||||
|
||||
**/
|
||||
|
||||
options mprint sgen;
|
||||
|
||||
%let folder=%mf_uid();
|
||||
%let tgtfolder=&mcTestAppLoc/temp/&folder;
|
||||
|
||||
/* create a folder */
|
||||
%mv_createfolder(path=&tgtfolder)
|
||||
|
||||
|
||||
%mp_assert(
|
||||
iftrue=(%mfv_existfolder(&tgtfolder)=1),
|
||||
desc=Check if created folder exists
|
||||
)
|
||||
|
||||
%mp_assertscope(SNAPSHOT)
|
||||
%mv_deleteviyafolder(path=&tgtfolder)
|
||||
/* ignore proc json vars */
|
||||
%mp_assertscope(COMPARE
|
||||
,ignorelist=MCLIB0_JADP1LEN MCLIB0_JADP2LEN MCLIB0_JADVLEN MCLIB2_JADP1LEN
|
||||
MCLIB2_JADVLEN
|
||||
)
|
||||
|
||||
%mp_assert(
|
||||
iftrue=(%mfv_existfolder(&tgtfolder)=0),
|
||||
desc=Check if deleted folder is gone
|
||||
)
|
||||
|
||||
/* delete folder with content */
|
||||
%mv_createfolder(path=&tgtfolder/content/and/stuff)
|
||||
%mp_assert(
|
||||
iftrue=(%mfv_existfolder(&tgtfolder/content/and/stuff)=1),
|
||||
desc=Check if folder with content exists
|
||||
)
|
||||
%mv_deleteviyafolder(path=&tgtfolder)
|
||||
%mp_assert(
|
||||
iftrue=(%mfv_existfolder(&tgtfolder)=0),
|
||||
desc=Check if deleted folder with subfolders is gone
|
||||
)
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mp_assert.sas
|
||||
@li mp_assertscope.sas
|
||||
@li mv_createjob.sas
|
||||
@li mv_getjobcode.sas
|
||||
|
||||
@@ -27,11 +28,17 @@ run;
|
||||
)
|
||||
|
||||
/* now get the code back */
|
||||
%mp_assertscope(SNAPSHOT)
|
||||
%mv_getjobcode(
|
||||
path=&mcTestAppLoc/services/temp,
|
||||
name=some_job,
|
||||
outref=mycode
|
||||
)
|
||||
/* exclude automatic proc json macro variables from scope check */
|
||||
%mp_assertscope(COMPARE,
|
||||
ignorelist=MCLIB2_JADP1LEN MCLIB2_JADP2LEN MCLIB2_JADPNUM MCLIB2_JADVLEN
|
||||
MCLIB2_JADP3LEN
|
||||
)
|
||||
|
||||
%let diditexist=NO;
|
||||
data work.test1;
|
||||
@@ -46,4 +53,4 @@ run;
|
||||
%mp_assert(
|
||||
iftrue=(&diditexist=NO),
|
||||
desc=Check if the code that was sent was successfully retrieved
|
||||
)
|
||||
)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mp_assert.sas
|
||||
@li mp_assertscope.sas
|
||||
@li mv_createjob.sas
|
||||
@li mv_jobexecute.sas
|
||||
@li mv_jobwaitfor.sas
|
||||
@@ -49,8 +50,12 @@ data _null_;
|
||||
run;
|
||||
|
||||
%* Finally, fetch the log;
|
||||
%mv_getjoblog(uri=%str(&uri),outref=mylog)
|
||||
|
||||
%mp_assertscope(SNAPSHOT)
|
||||
%mv_getjoblog(uri=%str(&uri),outref=mylog,mdebug=1)
|
||||
/* ignore auto proc json vars */
|
||||
%mp_assertscope(COMPARE
|
||||
,ignorelist=MCLIB2_JADP2LEN MCLIB2_JADPNUM MCLIB2_JADVLEN
|
||||
)
|
||||
|
||||
data _null_;
|
||||
infile mylog end=eof;
|
||||
@@ -67,4 +72,4 @@ run;
|
||||
%mp_assert(
|
||||
iftrue=(%str(&found)=1),
|
||||
desc=Check if the log was still fetched even though endsas was submitted
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user