00001 #!/usr/bin/env python 00002 # -*- Python -*- 00003 00004 00005 # \file test_InPortConsumer.py 00006 # \brief test for InPort template class 00007 # \date $Date: 2007/09/20 $ 00008 # \author Shinji Kurihara 00009 # 00010 # Copyright (C) 2003-2005 00011 # Task-intelligence Research Group, 00012 # Intelligent Systems Research Institute, 00013 # National Institute of 00014 # Advanced Industrial Science and Technology (AIST), Japan 00015 # All rights reserved. 00016 00017 00018 import sys 00019 sys.path.insert(1,"../") 00020 00021 import unittest 00022 00023 from InPortConsumer import * 00024 00025 import RTC, RTC__POA 00026 import OpenRTM_aist 00027 00028 class InPortConsumerMock: 00029 def __init__(self): 00030 pass 00031 00032 def publishInterfaceProfile(self, prop): 00033 return True 00034 00035 def subscribeInterface(self, prop): 00036 return True 00037 00038 00039 class TestInPortConsumer(unittest.TestCase): 00040 def setUp(self): 00041 self._mock = InPortConsumerMock() 00042 return 00043 00044 def test_publishInterfaceProfileFunc(self): 00045 pubFunc = InPortConsumerFactory.instance().publishInterfaceProfileFunc(None) 00046 pubFunc(self._mock) 00047 return 00048 00049 def test_subscribeInterfaceFunc(self): 00050 subFunc = InPortConsumerFactory.instance().subscribeInterfaceFunc(None) 00051 self.assertEqual(subFunc(self._mock),True) 00052 return 00053 00054 00055 ############### test ################# 00056 if __name__ == '__main__': 00057 unittest.main() 00058