#NEWLINE# def test_get_direct_children( self ) : #NEWLINE# #INDENT# container1 = self . _model_create ( 'nodes' , name = 'container1' ) #NEWLINE# container2a = self . _model_create ( 'nodes' , name = 'container2a' ) #NEWLINE# container2b = self . _model_create ( 'nodes' , name = 'container2b' ) #NEWLINE# container3a = self . _model_create ( 'nodes' , name = 'container3a' ) #NEWLINE# self . _model_create ( 'facts' , node_id = container2a [ 'id' ] , key = 'parent_id' , value = container1 [ 'id' ] ) #NEWLINE# self . _model_create ( 'facts' , node_id = container2b [ 'id' ] , key = 'parent_id' , value = container1 [ 'id' ] ) #NEWLINE# self . _model_create ( 'facts' , node_id = container3a [ 'id' ] , key = 'parent_id' , value = container2a [ 'id' ] ) #NEWLINE# self . _model_create ( 'facts' , node_id = container1 [ 'id' ] , key = 'backends' , value = [ 'container' , 'node' ] ) #NEWLINE# self . _model_create ( 'facts' , node_id = nodelist [ 'id' ] , key = 'backends' , value = [ 'container' , 'node' ] ) #NEWLINE# self . _model_create ( 'facts' , node_id = container2b [ 'id' ] , key = 'backends' , value = [ 'container' , 'node' ] ) #NEWLINE# self . _model_create ( 'facts' , node_id = container3a [ 'id' ] , key = 'backends' , value = [ 'container' , 'node' ] ) #NEWLINE# node1 = self . _model_create ( 'nodes' , name = 'node1' ) #NEWLINE# node2a = self . _model_create ( 'nodes' , name = 'node2a' ) #NEWLINE# node2b = self . _model_create ( 'nodes' , name = 'node2b' ) #NEWLINE# node3a = self . _model_create ( 'nodes' , name = 'node3a' ) #NEWLINE# self . _model_create ( 'facts' , node_id = node1 [ 'id' ] , key = 'parent_id' , value = container1 [ 'id' ] ) #NEWLINE# self . _model_create ( 'facts' , node_id = node1 [ 'id' ] , key = 'backends' , value = [ 'node' ] ) #NEWLINE# self . _model_create ( 'facts' , node_id = node2a [ 'id' ] , key = 'parent_id' , value = container2a [ 'id' ] ) #NEWLINE# self . _model_create ( 'facts' , node_id = node2a [ 'id' ] , key = 'backends' , value = [ 'node' ] ) #NEWLINE# self . _model_create ( 'facts' , node_id = node2b [ 'id' ] , key = 'parent_id' , value = container2b [ 'id' ] ) #NEWLINE# self . _model_create ( 'facts' , node_id = node2b [ 'id' ] , key = 'backends' , value = [ 'node' ] ) #NEWLINE# self . _model_create ( 'facts' , node_id = node3a [ 'id' ] , key = 'parent_id' , value = container3a [ 'id' ] ) #NEWLINE# self . _model_create ( 'facts' , node_id = node3a [ 'id' ] , key = 'backends' , value = [ 'node' ] ) #NEWLINE# nodelist = opencenter . webapp . utility . get_direct_children ( container1 [ 'id' ] ) #NEWLINE# self . logger . debug ( ( 'Expanded nodelist: %s' % nodelist ) ) #NEWLINE# node_ids = [ n [ 'id' ] for n in nodelist ] #NEWLINE# self . assertEquals ( len ( nodelist ) , 3 ) #NEWLINE# self . assertTrue ( ( ( node1 [ 'id' ] in node_ids ) and ( container2a [ 'id' ] in node_ids ) and ( container2b [ 'id' ] in node_ids ) ) ) #NEWLINE# self . _clean_table ( 'nodes' ) #NEWLINE# self . _clean_table ( 'facts' )