getrawdata.test.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief testing getrawdata service
4 
5  <h4> SAS Macros </h4>
6  @li mp_assertdsobs.sas
7  @li mx_testservice.sas
8 
9 **/
10 
11 
12 %let _program=&appLoc/services/public/getrawdata;
13 
14 /* test1 - regular table */
15 data work.params;
16  length name $32 value $1000;
17  name='type';value='CSV';output;
18  name='table';value="&dclib..MPE_X_TEST";output;
19  name='filter';value='0';output;
20 run;
21 
22 %mx_testservice(&_program,
23  viyacontext=&defaultcontext,
24  inputparams=work.params,
25  outref=webout,
26  viyaresult=WEBOUT_TXT,
27  mdebug=&sasjs_mdebug
28 )
29 
30 data work.results;
31  infile webout;
32  input;
33  if _infile_=:'PRIMARY_KEY_FIELD,SOME_CHAR' then do;
34  output;
35  output;
36  stop;
37  end;
38 run;
39 
40 %mp_assertdsobs(work.results,
41  desc=CSV file is successfully returned,
42  test=EQUALS 2,
43  outds=work.test_results
44 )
45 
46 /* test 2 - format table */
47 data work.params2;
48  length name $32 value $1000;
49  name='type';value='SAS';output;
50  name='table';value="DCTEST.DCFMTS-FC";output;
51  name='filter';value='0';output;
52 run;
53 
54 %mx_testservice(&_program,
55  viyacontext=&defaultcontext,
56  inputparams=work.params2,
57  outref=web2,
58  viyaresult=WEBOUT_TXT
59 )
60 
61 data work.results2;
62  infile web2;
63  input;
64  putlog _infile_;
65  if _infile_=:'datalines4;' then do;
66  output;
67  output;
68  output;
69  stop;
70  end;
71  if _n_>100 then stop;
72 run;
73 
74 %mp_assertdsobs(work.results2,
75  desc=datalines file is successfully returned for format catalog,
76  test=EQUALS 3,
77  outds=work.test_results
78 )