Loading...
Searching...
No Matches
dirlist.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief testing services/admin/dirlist.sas
4 @details
5 The deploy screen reads dirinfo and dirlist from this service's response.
6 These cases assert both objects are there, that checkwrite is not, and that
7 the depth cap, the row cap and the folders-only rule hold.
8
9 A blank parent lists the platform roots, so the case does not depend on a
10 path existing in the child's session.
11
12 <h4> SAS Macros </h4>
13 @li mpe_execute.sas
14 @li mp_assert.sas
15
16 @sasjslint {"maxLineLength": 80}
17
18**/
19
20%let _program=&appLoc/services/admin/dirlist;
21
22/**
23 * Test 1 - a blank parent answers with dirinfo and dirlist, not checkwrite
24 */
25data work.fromjs;
26 length parent $200;
27 parent='';
28 depth=1;
29 maxobs=50;
30run;
31
32%mpe_execute(&_program,
33 viyacontext=&defaultcontext,
34 inputdatasets=work.fromjs,
35 outlib=web1
36)
37
38data _null_;
39 call symputx('has_info',ifn(open('web1.dirinfo','i')>0,1,0),'l');
40 call symputx('has_list',ifn(open('web1.dirlist','i')>0,1,0),'l');
41 call symputx('has_chk',ifn(open('web1.checkwrite','i')>0,1,0),'l');
42run;
43
44%mp_assert(
45 iftrue=(&has_info=1),
46 desc=The listing returns dirinfo,
47 outds=work.test_results
48)
49%mp_assert(
50 iftrue=(&has_list=1),
51 desc=The listing returns dirlist,
52 outds=work.test_results
53)
54%mp_assert(
55 iftrue=(&has_chk=0),
56 desc=The listing does not return checkwrite,
57 outds=work.test_results
58)
59
60/**
61 * Test 2 - the caps and the folders-only rule, on the platform roots so the
62 case does not depend on the child's working directory
63 */
64data work.fromjs;
65 length parent $200;
66 parent='';
67 depth=9;
68 maxobs=1;
69run;
70
71%mpe_execute(&_program,
72 viyacontext=&defaultcontext,
73 inputdatasets=work.fromjs,
74 outlib=web2
75)
76
77%let rows2=0;
78data _null_;
79 set web2.dirlist end=eof;
80 n=_n_;
81 if eof then call symputx('rows2',n,'l');
82run;
83
84data _null_;
85 set web2.dirinfo;
86 call symputx('depth_out',cats(depth),'l');
87 call symputx('trunc_out',cats(truncated),'l');
88run;
89
90%let only_folders=Y;
91data _null_;
92 set web2.dirlist;
93 if upcase(strip(file_or_folder)) not in ('FOLDER','LOCKED') then
94 call symputx('only_folders','N','l');
95run;
96
97%mp_assert(
98 iftrue=("&depth_out"="3"),
99 desc=A depth above the cap comes back as the cap,
100 outds=work.test_results
101)
102%mp_assert(
103 iftrue=(&rows2=1),
104 desc=The row cap bounds the listing,
105 outds=work.test_results
106)
107%mp_assert(
108 iftrue=("%upcase(&trunc_out)"="Y"),
109 desc=The row cap says it was hit,
110 outds=work.test_results
111)
112%mp_assert(
113 iftrue=("%upcase(&only_folders)"="Y"),
114 desc=Only folders are offered,
115 outds=work.test_results
116)
117
118/**
119 * dump results to the log for offline inspection
120 */
121data _null_;
122 set work.test_results;
123 putlog 'TEST_RESULT_LINE: ' test_result ' - ' test_description;
124run;