# Path: wirecurly/dialplan/condition.py
# class Condition(object):
# class or_(object):
#     def __init__(self,attr=None,val=None,cont=False,expr=None):
#     def addAction(self,act,val,inline=False):
#     def addAntiAction(self,act,val,inline=False):
#     def addApplication(self, app,inline=False):
#     def existAction(self,act,val,inline=False):
#     def existAntiAction(self,act,val,inline=False):
#     def todict(self):
#     def __init__(self,*args):
#     def todict(self):


import unittest
from wirecurly.dialplan import condition
from wirecurly.dialplan.expression import *
			Test adding an application to a Condition
		'''
		self.cond.addApplication(AppMock())
		assert self.cond.existAction('test', '')

	def test_adding_application_inline(self):
		'''
			Test adding an application with inline=True to a Condition
		'''
		self.cond.addApplication(AppMock(), True)
		assert self.cond.existAction('test', '', True)
		
	def test_adding_existing_action(self):
		'''
			Test adding an existing action
		'''
		self.cond.addAction('answer','')
		self.cond.addAction('answer','')

class testOrConditionCreation(unittest.TestCase):
	'''
		Test conditions creation with logical or
	'''

	def setUp(self):
		'''
			Or Condition fixtures for tests
		'''
		self.cond1 = condition.Condition(expr=ExpressionTime('mon-fri','9-18'))
		self.cond2 = condition.Condition(expr=ExpressionTime('sat','9-13'))

# Path: wirecurly/dialplan/condition.py
# class Condition(object):
# class or_(object):
#     def __init__(self,attr=None,val=None,cont=False,expr=None):
#     def addAction(self,act,val,inline=False):
#     def addAntiAction(self,act,val,inline=False):
#     def addApplication(self, app,inline=False):
#     def existAction(self,act,val,inline=False):
#     def existAntiAction(self,act,val,inline=False):
#     def todict(self):
#     def __init__(self,*args):
#     def todict(self):


# Path: tests/test_dialplan/test_condition_creation.py
import unittest
from wirecurly.dialplan import condition
from wirecurly.dialplan.expression import *

			Test adding an application to a Condition
		'''
		self.cond.addApplication(AppMock())
		assert self.cond.existAction('test', '')

	def test_adding_application_inline(self):
		'''
			Test adding an application with inline=True to a Condition
		'''
		self.cond.addApplication(AppMock(), True)
		assert self.cond.existAction('test', '', True)
		
	def test_adding_existing_action(self):
		'''
			Test adding an existing action
		'''
		self.cond.addAction('answer','')
		self.cond.addAction('answer','')

class testOrConditionCreation(unittest.TestCase):
	'''
		Test conditions creation with logical or
	'''

	def setUp(self):
		'''
			Or Condition fixtures for tests
		'''
		self.cond1 = condition.Condition(expr=ExpressionTime('mon-fri','9-18'))
		self.cond2 = condition.Condition(expr=ExpressionTime('sat','9-13'))

		self.orcond = condition.or_(self.cond1,self.cond2)