def test_InstalledFile(self): from turtlebot_app_manager import InvalidAppException from turtlebot_app_manager.app import find_resource from turtlebot_app_manager.app_list import InstalledFile filename = find_resource('turtlebot_app_manager/apps1.installed') inf = InstalledFile(filename) self.failIf(inf._file_mtime is None) self.assertEquals(filename, inf.filename) self.assertEquals(1, len(inf.available_apps)) self.assertEquals('Android Joystick', inf.available_apps[0].display_name) #Had to be commented out, see app_list.py #mtime = inf._file_mtime #inf.update() #self.assertEquals(mtime, inf._file_mtime) #touch(filename) #inf.update() #self.assertNotEquals(mtime, inf._file_mtime) for bad in ['turtlebot_app_manager/bad.installed', 'turtlebot_app_manager/bad2.installed']: filename = find_resource(bad) try: inf = InstalledFile(filename) self.fail("should have thrown") except InvalidAppException: pass
def test_find_resource(self): from turtlebot_app_manager.app import find_resource rospack = rospkg.RosPack() path = rospack.get_path(PKG) test_dir = os.path.join(path, 'test') e = os.path.join(test_dir, 'empty.interface') self.assertEquals(e, find_resource('%s/empty.interface'%(PKG))) e = os.path.join(test_dir, 'applist1', 'apps1.installed') self.assertEquals(e, find_resource('%s/apps1.installed'%(PKG))) try: find_resource('empty.interface') self.fail("should have thrown ValueError: no package name") except ValueError: pass try: find_resource('turtlebot_app_manager') self.fail("should have thrown ValueError: no resource name") except ValueError: pass
def test_find_resource(self): from turtlebot_app_manager.app import find_resource rospack = rospkg.RosPack() path = rospack.get_path(PKG) test_dir = os.path.join(path, 'test') e = os.path.join(test_dir, 'empty.interface') self.assertEquals(e, find_resource('%s/empty.interface' % (PKG))) e = os.path.join(test_dir, 'applist1', 'apps1.installed') self.assertEquals(e, find_resource('%s/apps1.installed' % (PKG))) try: find_resource('empty.interface') self.fail("should have thrown ValueError: no package name") except ValueError: pass try: find_resource('turtlebot_app_manager') self.fail("should have thrown ValueError: no resource name") except ValueError: pass