How to use has_children method in avocado

Best Python code snippet using avocado_python

testTree.py

Source:testTree.py Github

copy

Full Screen

1from unittest import TestSuite, makeSuite23from Products.Naaya.tests.NaayaTestCase import NaayaTestCase4from Products.Naaya.NyFolder import addNyFolder5from naaya.content.url.url_item import addNyURL67class TestTree(NaayaTestCase):8 def afterSetUp(self):9 addNyFolder(self.portal, id='myfol', title='myfol')10 addNyFolder(self.portal.myfol, id='f1', title='f1')11 addNyFolder(self.portal.myfol.f1, id='f1a', title='f1a')12 addNyFolder(self.portal.myfol.f1, id='f1b', title='f1b')13 addNyFolder(self.portal.myfol, id='f2', title='f2')14 addNyURL(self.portal.myfol.f1, id='u1c', title='u1c')15 addNyURL(self.portal.myfol.f1.f1b, id='u1bx', title='u1bx')1617 def beforeTearDown(self):18 self.portal.manage_delObjects(['myfol'])1920 def test_empty(self):21 myfol = self.portal.myfol22 myfol.manage_delObjects(['f1', 'f2'])23 output = self.portal.getSiteMapTree(myfol, True, [])24 self.assertEqual(output, {'ob': myfol, 'has_children':False})2526 def test_full(self):27 myfol = self.portal.myfol28 output = self.portal.getSiteMapTree(myfol, True, ['myfol', 'myfol/f1', 'myfol/f1/f1b'])29 self.assertEqual(output,30 {'ob': myfol, 'has_children':True, 'children': [31 {'ob': myfol.f1, 'has_children': True, 'children': [32 {'ob': myfol.f1.f1a, 'has_children': False},33 {'ob': myfol.f1.f1b, 'has_children': True, 'children': [34 {'ob': myfol.f1.f1b.u1bx, 'has_children': False},35 ]},36 {'ob': myfol.f1.u1c, 'has_children': False},37 ]},38 {'ob': myfol.f2, 'has_children': False},39 ]})4041 def test_no_showitems(self):42 myfol = self.portal.myfol43 output = self.portal.getSiteMapTree(myfol, False, ['myfol', 'myfol/f1', 'myfol/f1/f1b'])44 self.assertEqual(output,45 {'ob': myfol, 'has_children':True, 'children': [46 {'ob': myfol.f1, 'has_children': True, 'children': [47 {'ob': myfol.f1.f1a, 'has_children': False},48 {'ob': myfol.f1.f1b, 'has_children': False},49 ]},50 {'ob': myfol.f2, 'has_children': False},51 ]})5253 def test_expand(self):54 myfol = self.portal.myfol5556 output = self.portal.getSiteMapTree(myfol, True, ['myfol'])57 self.assertEqual(output,58 {'ob': myfol, 'has_children':True, 'children': [59 {'ob': myfol.f1, 'has_children': True},60 {'ob': myfol.f2, 'has_children': False},61 ]})6263 output = self.portal.getSiteMapTree(myfol, True, ['myfol', 'myfol/f1'])64 self.assertEqual(output,65 {'ob': myfol, 'has_children':True, 'children': [66 {'ob': myfol.f1, 'has_children': True, 'children': [67 {'ob': myfol.f1.f1a, 'has_children': False},68 {'ob': myfol.f1.f1b, 'has_children': True},69 {'ob': myfol.f1.u1c, 'has_children': False},70 ]},71 {'ob': myfol.f2, 'has_children': False}, ...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful