Example #1
0
 def test_main(self, load_file, load_commands, execute_commands):
     load_file.return_value = ""
     load_commands.return_value = []
     main()
     load_file.assert_called_with()
     load_commands.assert_called_with("")
     execute_commands.assert_called_with([])
Example #2
0
 def test_main(self, load_file, load_commands, execute_commands):
     load_file.return_value = ""
     load_commands.return_value = []
     main()
     load_file.assert_called_with()
     load_commands.assert_called_with("")
     execute_commands.assert_called_with([])
 def test_called_on_config_change(self):
     config_changed = self.patch_hook('config_changed')
     update_nrpe_config = self.patch_hook('update_nrpe_config')
     statistics_interface = self.patch_hook('statistics_interface')
     hooks.main('config-changed')
     config_changed.assert_called_once_with()
     update_nrpe_config.assert_called_once_with()
     statistics_interface.assert_called_once_with()
Example #4
0
 def test_calls_hooks(self):
     install_hook = self.patch_hook('install_hook')
     config_changed = self.patch_hook('config_changed')
     update_nrpe_config = self.patch_hook('update_nrpe_config')
     hooks.main('upgrade-charm')
     install_hook.assert_called_once_with()
     config_changed.assert_called_once_with()
     update_nrpe_config.assert_called_once_with()
Example #5
0
 def test_called_on_config_change(self):
     config_changed = self.patch_hook('config_changed')
     update_nrpe_config = self.patch_hook('update_nrpe_config')
     statistics_interface = self.patch_hook('statistics_interface')
     hooks.main('config-changed')
     config_changed.assert_called_once_with()
     update_nrpe_config.assert_called_once_with()
     statistics_interface.assert_called_once_with()
Example #6
0
import hooks

if __name__ == "__main__":
    hooks.main(port=7000, host="127.0.0.1")