Update abac test script.
This commit is contained in:
parent
270f2b3582
commit
ee505be1e7
|
@ -18,6 +18,9 @@
|
|||
'''
|
||||
|
||||
|
||||
import datetime
|
||||
import time
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.db import transaction
|
||||
|
||||
|
@ -304,7 +307,7 @@ class Command(BaseCommand):
|
|||
|
||||
print '--> Create a user'
|
||||
rdm_str = ''.join(random.choice(string.ascii_uppercase + \
|
||||
string.digits) for x in range(8))
|
||||
string.digits) for x in range(8))
|
||||
username = 'user_' + rdm_str
|
||||
user, created = User.objects.get_or_create(username=username)
|
||||
if not user:
|
||||
|
@ -473,7 +476,9 @@ class Command(BaseCommand):
|
|||
attr = {}
|
||||
attr['name'] = 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/dateofbirth'
|
||||
attr['namespace'] = 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims'
|
||||
attr['values'] = ('17', )
|
||||
attr['values'] = ('22', )
|
||||
exp = datetime.datetime.now() + datetime.timedelta(days=1)
|
||||
attr['expiration_date'] = exp.isoformat()
|
||||
data.append(attr)
|
||||
attr = {}
|
||||
attr['name'] = 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname'
|
||||
|
@ -618,10 +623,11 @@ class Command(BaseCommand):
|
|||
print "Access denied, new rule to satisfy %s" % msg
|
||||
print "------------------------------------------------------"
|
||||
|
||||
raise Exception('Happy end')
|
||||
|
||||
except Exception, err:
|
||||
print "Exception: %s" %str(err)
|
||||
transaction.rollback()
|
||||
else:
|
||||
print "Happy end"
|
||||
transaction.rollback()
|
||||
|
||||
print '\n-------- DONE --------'
|
||||
|
|
Reference in New Issue