Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mv_getusergroups.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing mv_getusergroups macro
4
5 <h4> SAS Macros </h4>
6 @li mf_existvar.sas
7 @li mf_getuser.sas
8 @li mf_nobs.sas
9 @li mp_assert.sas
10 @li mp_assertdsobs.sas
11 @li mp_assertscope.sas
12 @li mv_getusergroups.sas
13
14**/
15
16%mp_assertscope(SNAPSHOT)
17%mv_getusergroups(user=%mf_getuser(), outds=work.usergroups)
18%mp_assertscope(COMPARE,
19 desc=mv_getusergroups does not leak scope,
20 ignorelist=MC0_JADP1LEN MC0_JADP2LEN MC0_JADP3LEN MC0_JADPNUM MC0_JADVLEN,
21 outds=work.test_results
22)
23
24%mp_assert(
25 iftrue=(%sysfunc(exist(work.usergroups))=1),
26 desc=Check the user groups dataset was created
27)
28%mp_assert(
29 iftrue=(%mf_nobs(work.usergroups)>0),
30 desc=Check the user belongs to at least one group
31)
32%mp_assert(
33 iftrue=(%mf_existvar(work.usergroups,id)>0),
34 desc=Check the dataset carries an id column
35)
36
37/* a user the server does not know - the macro answers with the documented
38 columns and zero rows rather than failing on the 404 body */
39%mp_assertscope(SNAPSHOT)
40%mv_getusergroups(user=no_such_user_sasjs_core, outds=work.unknown)
41%mp_assertscope(COMPARE,
42 desc=mv_getusergroups does not leak scope on an unknown user,
43 outds=work.test_results
44)
45%mp_assertdsobs(work.unknown,
46 desc=Check an unknown user returns no rows,
47 test=EMPTY,
48 outds=work.test_results
49)
50%mp_assert(
51 iftrue=(%mf_existvar(work.unknown,providerId)>0),
52 desc=Check the unknown-user listing carries a providerId column
53)
54%mp_assert(
55 iftrue=(%mf_existvar(work.unknown,implicit)>0),
56 desc=Check the unknown-user listing carries an implicit column
57)