Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mfs_httpheader.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing mfs_httpheader.sas macro
4
5 <h4> SAS Macros </h4>
6 @li mfs_httpheader.sas
7 @li mp_assert.sas
8 @li mp_assertscope.sas
9
10**/
11
12%let orig_sasjs_stpsrv_header_loc=&sasjs_stpsrv_header_loc;
13%let sasjs_stpsrv_header_loc=%sysfunc(pathname(work))/header.txt;
14
15%mp_assertscope(SNAPSHOT)
16%mfs_httpheader(Content-Type,application/csv)
17%mp_assertscope(COMPARE,ignorelist=sasjs_stpsrv_header_loc)
18
19data _null_;
20 infile "&sasjs_stpsrv_header_loc";
21 input;
22 if _n_=1 then call symputx('test1',_infile_);
23run;
24
25%mp_assert(
26 iftrue=(&syscc=0),
27 desc=Check code ran without errors,
28 outds=work.test_results
29)
30%mp_assert(
31 iftrue=("&test1"="Content-Type: application/csv"),
32 desc=Checking line was created,
33 outds=work.test_results
34)
35
36%mfs_httpheader(Content-Type,application/text)
37%let test2=0;
38data _null_;
39 infile "&sasjs_stpsrv_header_loc";
40 input;
41 if _n_=2 then call symputx('test2',_infile_);
42run;
43
44%mp_assert(
45 iftrue=(&syscc=0),
46 desc=Check code ran without errors for test2,
47 outds=work.test_results
48)
49%mp_assert(
50 iftrue=("&test2"="Content-Type: application/text"),
51 desc=Checking line was created,
52 outds=work.test_results
53)
54
55
56/* reset header so the test will pass */
57%let sasjs_stpsrv_header_loc=&orig_sasjs_stpsrv_header_loc;