def test_inner_content(self):
     """
     tests {% shot %} with inner content to wrap shots around
     """
     register('foo', TemplateMixer('shots/tests/foo1.html'))
     register('foo', TemplateMixer('shots/tests/foo2.html'))
     text = Template(TEMPLATE_INNER).render(Context())
     self.assertEqual("<ul><li>foo1</li><li>foo2</li></ul>", text)
    def test_register_new_shot(self):
        """
        test registering a new shot
        """
        register('foo', TemplateMixer('shots/tests/foo1.html'))
        register('bar', TemplateMixer('shots/tests/foo1.html'))

        self.assertTrue('foo' in MUDDLE_SHOTS)
        self.assertTrue('bar' in MUDDLE_SHOTS)

        self.assertEqual(1, len(MUDDLE_SHOTS['foo'].template_mixers))
        self.assertEqual(1, len(MUDDLE_SHOTS['bar'].template_mixers))
    def test_register_existing_shot(self):
        """
        test registering mixers in an existing Shot
        """
        self.test_register_new_shot()

        register('foo', TemplateMixer('shots/tests/foo2.html'))
        register('bar', TemplateMixer('shots/tests/foo2.html'))

        self.assertTrue('foo' in MUDDLE_SHOTS)
        self.assertTrue('bar' in MUDDLE_SHOTS)
        self.assertEqual(2, len(MUDDLE_SHOTS['foo'].template_mixers))
        self.assertEqual(2, len(MUDDLE_SHOTS['bar'].template_mixers))
    def test_register_combine_template_mixers(self):
        """
        Tests that template mixers are combined properly when adding multiple
        template mixers
        """
        register('foo', TemplateMixer('shots/tests/foo1.html'))
        register('foo', TemplateMixer('shots/tests/foo2.html'))
        register('foo', TemplateMixer('shots/tests/foo2.html'))
        register('foo', TemplateMixer('shots/tests/foo3.html'))

        mixers = MUDDLE_SHOTS['foo'].template_mixers
        self.assertTrue('shots/tests/foo1.html' in mixers)
        self.assertTrue('shots/tests/foo2.html' in mixers)
        self.assertTrue('shots/tests/foo3.html' in mixers)
        self.assertEqual(3, len(mixers))
 def test_multiple_mixers(self):
     register('foo', TemplateMixer('shots/tests/foo1.html'))
     register('foo', TemplateMixer('shots/tests/foo2.html'))
     text = Template(TEMPLATE).render(Context())
     self.assertEqual("<b>foo1foo2</b>", text)
 def test_no_mixers(self):
     register('foo')
     text = Template(TEMPLATE).render(Context())
     self.assertEqual("<b></b>", text)
Esempio n. 7
0
from muddle.shots import register, TemplateMixer

# permissions
register("user-detail-tab", TemplateMixer("object_permissions/muddle/user_permissions.html"))
register("group-detail-tab", TemplateMixer("object_permissions/muddle/group_permissions.html"))

# group list
register("group-list-table-headers", TemplateMixer("object_permissions/muddle/group/group_headers.html"))
register("group-list-table-cells", TemplateMixer("object_permissions/muddle/group/group_row.html"))

# group users
register("group-users-table-headers", TemplateMixer("object_permissions/muddle/group/user_headers.html"))
register("group-users-table-cells", TemplateMixer("object_permissions/muddle/group/user_row.html"))
from muddle.shots import register, TemplateMixer

# permissions
register('user-detail-tab',
         TemplateMixer('object_permissions/muddle/user_permissions.html'))
register('group-detail-tab',
         TemplateMixer('object_permissions/muddle/group_permissions.html'))

# group list
register('group-list-table-headers',
         TemplateMixer('object_permissions/muddle/group/group_headers.html'))
register('group-list-table-cells',
         TemplateMixer('object_permissions/muddle/group/group_row.html'))

# group users
register('group-users-table-headers',
         TemplateMixer('object_permissions/muddle/group/user_headers.html'))
register('group-users-table-cells',
         TemplateMixer('object_permissions/muddle/group/user_row.html'))
 def test_register_empty_shot(self):
     """
     test registering a shot with no mixers
     """
     register('foo')
     self.assertTrue('foo' in MUDDLE_SHOTS)
Esempio n. 10
0
from muddle.shots import register, TemplateMixer

register('user-detail-tab', TemplateMixer('object_log/muddle/user_actions_tab.html'))
register('user-detail-tab', TemplateMixer('object_log/muddle/user_log_tab.html'))
register('group-detail-tab', TemplateMixer('object_log/muddle/group_log_tab.html'))