Type : MIXTE
Le script génère ses propres données de test (création de groupe) via des macros d'administration et interroge les métadonnées du système (utilisateurs/groupes) via la macro testée.
| 1 | %mp_assertscope(SNAPSHOT) |
| 2 | %ms_getusers(outds=work.test1,mdebug=&sasjs_mdebug) |
| 3 | %mp_assertscope(COMPARE |
| 4 | ,ignorelist=MCLIB0_JADP1LEN MCLIB0_JADPNUM MCLIB0_JADVLEN |
| 5 | ) |
| 6 | |
| 7 | %mp_assertdsobs(work.test1,test=ATLEAST 1) |
| 1 | /* create a group */ |
| 2 | %let group=%substr(%mf_getuniquename(),1,8); |
| 3 | %ms_creategroup(&group, desc=some desc,mdebug=&sasjs_mdebug,outds=work.group) |
| 4 | %let gid=0; |
| 5 | DATA _null_; |
| 6 | SET work.group; |
| 7 | call symputx('gid',groupid); |
| 8 | RUN; |
| 1 | /* add a member */ |
| 2 | %ms_adduser2group(uid=1,gid=&gid) |
| 3 | |
| 4 | /* extract the members */ |
| 5 | %ms_getusers(group=&group,outds=test2) |
| 1 | /* check the user is in the output list */ |
| 2 | %let checkid=0; |
| 3 | DATA _null_; |
| 4 | SET work.test2; |
| 5 | IF id=1 THEN call symputx('checkid',1); |
| 6 | RUN; |
| 7 | %mp_assert( |
| 8 | iftrue=(&checkid=1), |
| 9 | desc=Checking that admin user was created in the new group, |
| 10 | outds=work.test_results |
| 11 | ) |