def test_playbook_treeview(self): ctx = ansible_run() treeview = jsonutils.loads(u.playbook_treeview(ctx['playbook'].id)) # ansible_run provides two fake files: # /some/path/main.yml and /playbook.yml for f in treeview: if f['text'] == 'some': self.assertEqual(f['text'], 'some') child = f['nodes'][0] self.assertEqual(child['text'], 'path') child = child['nodes'][0] self.assertEqual(child['text'], 'main.yml') self.assertEqual(child['dataAttr']['load'], ctx['task_file'].id) else: self.assertEqual(f['text'], 'playbook.yml') self.assertEqual(f['dataAttr']['load'], ctx['pb_file'].id)
def test_playbook_treeview(self): ctx = ansible_run() treeview = jsonutils.loads(u.playbook_treeview(ctx['playbook'].id)) # ansible_run provides two fake files: # /some/path/main.yml and /playbook.yml for f in treeview: if f['text'] == 'some': self.assertEqual(f['text'], 'some') child = f['nodes'][0] self.assertEqual(child['text'], 'path') child = child['nodes'][0] self.assertEqual(child['text'], 'main.yml') self.assertEqual(child['dataAttr']['load'], ctx['task_file'].id + '/') else: self.assertEqual(f['text'], 'playbook.yml') self.assertEqual( f['dataAttr']['load'], ctx['pb_file'].id + '/' )
def jinja_treeview(playbook): return playbook_treeview(playbook)