source: tests/test_util.py @ 7c748c9

abac0-leakabac0-mei
Last change on this file since 7c748c9 was 3c30b59, checked in by Mei <mei@…>, 11 years ago

1) add in new refactored regression testing directory
2) undo the abac.hh/ABAC.hh api changes
3) merged with Ted's changes to attribute format/nickname/issuer processing

  • Property mode set to 100755
File size: 837 bytes
Line 
1#!/usr/bin/env python
2
3debug=0
4
5import os
6import ABAC
7
8# EXPECT 1, success, 0, failure
9def runTest(FNAME,LABEL,CTXT,ROLE,PRIN,EXPECT,MSG):
10    (success, credentials) = CTXT.query(ROLE,PRIN)
11    if EXPECT:
12#expect success, got success
13        if success: 
14            print "GOOD:%s:%s:%s" %(FNAME,LABEL,MSG)
15#expect success, got failure
16        else:
17            print "BAD:%s:%s:did not expect failure,%s" %(FNAME,LABEL,MSG)
18    else:
19#expect failure, got success
20        if success:
21            print "BAD:%s:%s:expected failure but got success,%s" %(FNAME,LABEL,MSG)
22#expect failure, got failure
23        else:
24            print "GOOD:%s:%s:expected failure,%s" %(FNAME,LABEL,MSG)
25
26    if debug:
27        for credential in credentials:
28            print "credential %s <- %s" % (credential.head().string(), credential.tail().string())
Note: See TracBrowser for help on using the repository browser.