def testSerializeShellOutline(self): path = os.path.join(SCRIPTS_DIR, 'shell.outline') outline.config.set('outline', 'home', '/opencue/outline') outline.config.set('outline', 'user_dir', '/tmp/opencue/user') ol = outline.load_outline(path) launcher = outline.cuerun.OutlineLauncher(ol, user=TEST_USER) outlineXml = ET.fromstring(outline.backend.cue.serialize(launcher)) self.assertEqual('spec', outlineXml.tag) self.assertEqual(1, len(outlineXml.findall('facility'))) self.assertEqual('local', outlineXml.find('facility').text) self.assertEqual(1, len(outlineXml.findall('show'))) self.assertEqual('testing', outlineXml.find('show').text) self.assertEqual(1, len(outlineXml.findall('shot'))) self.assertEqual('default', outlineXml.find('shot').text) self.assertEqual(1, len(outlineXml.findall('user'))) self.assertEqual(TEST_USER, outlineXml.find('user').text) self.assertEqual(1, len(outlineXml.findall('job'))) job = outlineXml.find('job') self.assertEqual('shell', job.get('name')) self.assertEqual(1, len(job.findall('env'))) self.assertEqual(0, len(list(job.find('env')))) self.assertEqual(1, len(job.findall('layers'))) self.assertEqual(1, len(job.find('layers').findall('layer'))) layer = job.find('layers').find('layer') self.assertEqual('cmd', layer.get('name')) self.assertEqual('Render', layer.get('type')) self.assertEqual(1, len(layer.findall('cmd'))) self.assertEqual( '/opencue/outline/wrappers/opencue_wrap_frame ' '/tmp/opencue/user ' '/opencue/outline/bin/pycuerun ' '{scripts_dir}/shell.outline ' '-e #IFRAME#-cmd ' '--version latest ' '--repos ' '--debug'.format(scripts_dir=SCRIPTS_DIR), layer.find('cmd').text) self.assertEqual(1, len(layer.findall('range'))) self.assertEqual('1000-1000', layer.find('range').text) self.assertEqual(1, len(layer.findall('chunk'))) self.assertEqual('1', layer.find('chunk').text) self.assertEqual(1, len(layer.findall('services'))) self.assertEqual(1, len(layer.find('services').findall('service'))) self.assertEqual('shell', layer.find('services').find('service').text) self.assertEqual(1, len(outlineXml.findall('depends'))) self.assertEqual(0, len(list(outlineXml.find('depends'))))
def assertCores(self, ol, v): launcher = outline.cuerun.OutlineLauncher(ol, user=TEST_USER) outlineXml = ET.fromstring(outline.backend.cue.serialize(launcher)) job = outlineXml.find('job') layer = job.find('layers').find('layer') self.assertEqual(v, layer.find('cores').text)