Add in start of worker_manager tests and fakes
diff --git a/tests/test_worker_manager.py b/tests/test_worker_manager.py
index ac2b2a9..11b1a22 100644
--- a/tests/test_worker_manager.py
+++ b/tests/test_worker_manager.py
@@ -1,29 +1,46 @@
-import unittest
+#!/usr/bin/python2
+#
+# Copyright 2013 Rackspace Australia
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
-class TestGearmanManager(unittest.TestCase):
- def test___init__(self):
- # gearman_manager = GearmanManager(config, tasks)
- assert False # TODO: implement your test here
- def test_run(self):
- # gearman_manager = GearmanManager(config, tasks)
- # self.assertEqual(expected, gearman_manager.run())
- assert False # TODO: implement your test here
+import json
+import os
+import testtools
+from fakes import FakeGearmanManager, FakeGearmanServer
- def test_setup_gearman(self):
- # gearman_manager = GearmanManager(config, tasks)
- # self.assertEqual(expected, gearman_manager.setup_gearman())
- assert False # TODO: implement your test here
+CONFIG_DIR = os.path.join(os.path.dirname(__file__), 'etc')
+with open(os.path.join(CONFIG_DIR, 'config.json'), 'r') as config_stream:
+ CONFIG = json.load(config_stream)
- def test_stop(self):
- # gearman_manager = GearmanManager(config, tasks)
- # self.assertEqual(expected, gearman_manager.stop())
- assert False # TODO: implement your test here
- def test_stopped(self):
- # gearman_manager = GearmanManager(config, tasks)
- # self.assertEqual(expected, gearman_manager.stopped())
- assert False # TODO: implement your test here
+class TestGearmanManager(testtools.TestCase):
+ def setUp(self):
+ super(TestGearmanManager, self).setUp()
+ self.config = CONFIG
+ self.tasks = []
+ self.gearman_server = FakeGearmanServer(
+ self.config['zuul_server']['gearman_port'])
+
+ self.gearman_manager = FakeGearmanManager(self.config,
+ self.tasks,
+ self)
+
+ def test_manager_function_registered(self):
+ """ Check the manager is set up correctly and registered with the
+ gearman server with an appropriate function """
+ pass
if __name__ == '__main__':
unittest.main()