Beispiel #1
0
    def setUpClass(self):
        sample_config = """
[account]
default-private
disallow-extension
owner   = public
withdraw=public
deposit =public
"""
        self.account1=applyPolicy(account,io.BytesIO(sample_config))
        self.instance=self.account1()
Beispiel #2
0
    def setUpClass(self):
        sample_config = """
[account]
default-public
balance =private
history =private
owner   = public
withdraw=public
deposit =public
"""
        self.account1=applyPolicy(account,io.BytesIO(sample_config))
        self.instance=self.account1()
Beispiel #3
0
class account():
     def __init__(self,owner="bart",balance=0):
          self.owner=owner
          self.balance=balance
          self.history=[]

     def withdraw(self,amount=0):
          self.history.append(('withdraw',amount))
          self.balance-=amount

     def deposit(self,amount=0):
          self.history.append(('deposit',amount))
          self.balance+=amount

from opaque import applyPolicy
account=applyPolicy(account,'account.cfg')
Beispiel #4
0
#!/usr/bin/python

from opaque import applyPolicy
from random import shuffle

class Croupier(object):
	def __init__(self):
		self.deck=range(52)
		shuffle(self.deck)
	def drawCard(self):
		return self.deck.pop()

Croupier=applyPolicy(Croupier,'croupier_policy.cfg')