Repository: PokemonGoF/PokemonGo-Bot

Issue:
RandomAlivePause RandomPause runs even disabled
I notice these run even disabled in config
RandomAlivePause
RandomPause
### Your FULL config.json (remove your username, password, gmapkey and any other private info)

<!-- Provide your FULL config file, feel free to use services such as pastebin.com to reduce clutter -->

```
 {
    "//NOTE: This task MUST be placed on the top of task list": {},
    "type": "RandomAlivePause",
    "config": {
      "enabled": false,
      "min_duration": "00:00:10",
      "max_duration": "00:10:00",
      "min_interval": "00:05:00",
      "max_interval": "01:30:00"
    }
  },
  {
    "type": "HandleSoftBan"
  },
  {
    "type": "RandomPause",
    "config": {
      "enabled": false,
      "min_duration": "00:00:10",
      "max_duration": "00:10:00",
      "min_interval": "00:10:00",
      "max_interval": "02:00:00"
    }
  },
```
### Output when issue occurred

<!-- Provide a reasonable sample from your output log (not just the error message), feel free to use services such as pastebin.com to reduce clutter -->

[2016-09-16 21:09:07] [RandomAlivePause] [INFO] Next random alive pause at 21:24:19, for a duration of 0:06:03
[2016-09-16 21:09:07] [RandomPause] [INFO] Next random pause at 22:01:19, for a duration of 0:08:44
### Steps to Reproduce

<!-- Tell us the steps you have taken to reproduce the issue -->

start bot
### Other Information

Branch: 
master
Git Commit: 
a8ee31256d412413b107cce81b62059634e8c802



Discussion:
Unless I'm mistaken, that's only an output at start of the bot, it won't actually pause at the specified time.


Resolving patch:
diff --git a/pokemongo_bot/__init__.py b/pokemongo_bot/__init__.py
--- a/pokemongo_bot/__init__.py
+++ b/pokemongo_bot/__init__.py
@@ -214,6 +214,7 @@ def _register_events(self):
         self.event_manager.register_event('buddy_pokemon', parameters=('pokemon', 'iv', 'cp'))
         self.event_manager.register_event('buddy_reward', parameters=('pokemon', 'family', 'candy_earned', 'candy'))
         self.event_manager.register_event('buddy_walked', parameters=('pokemon', 'distance_walked', 'distance_needed'))
+        self.event_manager.register_event('task_disabled', parameters=('task_name',))
 
         #  ignore candy above threshold
         self.event_manager.register_event(
diff --git a/pokemongo_bot/event_handlers/logging_handler.py b/pokemongo_bot/event_handlers/logging_handler.py
--- a/pokemongo_bot/event_handlers/logging_handler.py
+++ b/pokemongo_bot/event_handlers/logging_handler.py
@@ -80,6 +80,7 @@ class LoggingHandler(EventHandler):
         'softban_log':                       'magenta',
         'spin_limit':                        'red',
         'spun_pokestop':                     'cyan',
+        'task_disabled':                     'yellow',
         'threw_berry_failed':                'red',
         'transfer_log':                      'magenta',
         'unknown_spin_result':               'red',
diff --git a/pokemongo_bot/tree_config_builder.py b/pokemongo_bot/tree_config_builder.py
--- a/pokemongo_bot/tree_config_builder.py
+++ b/pokemongo_bot/tree_config_builder.py
@@ -54,6 +54,17 @@ def build(self):
                                         'See config.json.*example for more information.')
                 continue
 
+            if not task_config.get("enabled", True):
+                msg = "Task {task_name} is disabled"
+                self.bot.event_manager.emit(
+                    'task_disabled',
+                    sender=self,
+                    level='info',
+                    formatted=msg,
+                    data={'task_name': task_type}
+                )
+                continue
+
             if self._is_plugin_task(task_type):
                 worker = self.plugin_loader.get_class(task_type)
             else:


Test patch:
diff --git a/tests/tree_config_builder_test.py b/tests/tree_config_builder_test.py
--- a/tests/tree_config_builder_test.py
+++ b/tests/tree_config_builder_test.py
@@ -1,6 +1,7 @@
 import unittest
 import json
 import os
+from mock import MagicMock
 from pokemongo_bot import PokemonGoBot, ConfigException, MismatchTaskApiVersion, TreeConfigBuilder, PluginLoader, BaseTask
 from pokemongo_bot.cell_workers import HandleSoftBan, CatchPokemon
 from pokemongo_bot.test.resources.plugin_fixture import FakeTask, UnsupportedApiTask
@@ -10,7 +11,9 @@ def convert_from_json(str):
 
 class TreeConfigBuilderTest(unittest.TestCase):
     def setUp(self):
-        self.bot = {}
+        self.bot = MagicMock()
+        self.bot.event_manager = MagicMock()
+        self.bot.event_manager.emit = lambda *args, **kwargs: None
 
     def test_should_throw_on_no_type_key(self):
         obj = convert_from_json("""[{