Beispiel #1
0
 def test_override_ordered_by(self):
     _make_portlet(name='foo', weight=3)
     _make_portlet(name='bar', weight=2)
     _make_portlet(name='baz', weight=-1)
     portlets = Portlet.get_all(order_by='weight')
     self.assertEqual(len(portlets), 3)
     self.assertEqual(portlets[0].name, 'baz')
     self.assertEqual(portlets[1].name, 'bar')
     self.assertEqual(portlets[2].name, 'foo')
Beispiel #2
0
 def test_ordered_by_position_by_default(self):
     _make_portlet(name='foo', position='above_content')
     _make_portlet(name='bar', position='above_footer')
     _make_portlet(name='bla', position='above_sidebar')
     _make_portlet(name='baz', position='below_sidebar')
     portlets = Portlet.get_all()
     self.assertEqual(len(portlets), 4)
     self.assertEqual(portlets[0].name, 'foo')
     self.assertEqual(portlets[1].name, 'bar')
     self.assertEqual(portlets[2].name, 'bla')
     self.assertEqual(portlets[3].name, 'baz')
Beispiel #3
0
 def test_filter_by(self):
     _make_portlet(name='foo', position='above_content')
     _make_portlet(name='bar', position='above_footer')
     portlets = Portlet.get_all(filter_by={'position': 'above_content'})
     self.assertEqual(len(portlets), 1)
     self.assertEqual(portlets[0].name, 'foo')
Beispiel #4
0
 def test_portlets_limit(self):
     _make_portlet(name='foo')
     _make_portlet(name='bar')
     _make_portlet(name='baz')
     portlets = Portlet.get_all(limit=2)
     self.assertEqual(len(portlets), 2)
Beispiel #5
0
 def test_all_portlets(self):
     _make_portlet(name='foo')
     _make_portlet(name='bar')
     _make_portlet(name='baz')
     portlets = Portlet.get_all()
     self.assertEqual(len(portlets), 3)
Beispiel #6
0
 def test_no_portlets(self):
     portlets = Portlet.get_all()
     self.assertEqual(len(portlets), 0)