Exemplo n.º 1
0
    def test_help(self, container, actions, is_mod, is_fn):
        is_mod.side_effect = lambda thing: thing == Module
        is_fn.return_value = True
        actions.return_value.collated.return_value = [
            Action('report', dict(hours=24)),
            Action('reboot', dict(minutes=10)),
        ]
        dispatcher = Mock(catalog={
            'admin': Admin,
            'dog': Dog,
            'mod': Module,
        })
        plugins = [
            Plugin('animals', True, dispatcher),
            Plugin('fish', False, None),
        ]
        container.return_value.all.return_value = plugins

        # test
        admin = Admin()
        s = admin.help()

        # validation
        self.assertEqual(s, HELP % {'plugin': plugins[0].name})
Exemplo n.º 2
0
    def test_help(self, container, actions, is_mod, is_fn):
        is_mod.side_effect = lambda thing: thing == Module
        is_fn.return_value = True
        actions.return_value.collated.return_value = [
            Action('report', dict(hours=24)),
            Action('reboot', dict(minutes=10)),
        ]
        dispatcher = Mock(catalog={
            'admin': Admin,
            'dog': Dog,
            'mod': Module,
        })
        plugins = [
            Plugin('animals', True, dispatcher),
            Plugin('fish', False, None),
        ]
        container.return_value.all.return_value = plugins

        # test
        admin = Admin()
        s = admin.help()

        # validation
        self.assertEqual(s, HELP % {'plugin': plugins[0].name})
Exemplo n.º 3
0
 def show(self):
     container = Container()
     admin = Admin(container)
     return admin.help()
Exemplo n.º 4
0
 def test_help(self, loaded, actions):
     container = Mock()
     admin = Admin(container)
     report = admin.help()
     loaded.assert_called_once_with(container, actions.return_value)
     self.assertEqual(report, loaded.return_value)
Exemplo n.º 5
0
 def show(self):
     container = Container()
     admin = Admin(container)
     return admin.help()
Exemplo n.º 6
0
 def test_help(self, loaded, actions):
     container = Mock()
     admin = Admin(container)
     report = admin.help()
     loaded.assert_called_once_with(container, actions.return_value)
     self.assertEqual(report, loaded.return_value)