예제 #1
0
 def test_build_children(self):
     page = PageletPage(request=mock_data.mock_request, request_kwargs={}, page=mock_page_model)
     children = page._build_children()
     self.assertEqual(len(children), len(mock_active_pagelets_return), 'incorrect number of children returned')
     self.assertIn(mock_pagelet_model_1.name, children, '%s not in children' % mock_pagelet_model_1.name)
     self.assertIsInstance(children[mock_pagelet_model_1.name], BasePagelet, '%s not a pagelet' % mock_pagelet_model_1.name)
예제 #2
0
 def test_get_pagelet_no_key(self):
     page = PageletPage(request=mock_data.mock_request, request_kwargs={}, page=mock_page_model)
     pagelet = page.get_pagelet()
     self.assertIsInstance(pagelet, BasePagelet, 'pagelet was not a Pagelet %s' % pagelet)
예제 #3
0
 def test_get_pagelet_not_found(self):
     page = PageletPage(request=mock_data.mock_request, request_kwargs={}, page=mock_page_model)
     pagelet = page.get_pagelet('test')
     self.assertIsNone(pagelet, 'pagelet was not none %s' % pagelet)
예제 #4
0
 def test_get_pagelet(self):
     page = PageletPage(request=mock_data.mock_request, request_kwargs={}, page=mock_page_model)
     pagelet = page.get_pagelet(mock_pagelet_model_2.name)
     self.assertIs(pagelet._data_model, mock_pagelet_model_2, 'got incorrect pagelet %s' % pagelet)