From 8570d70eafa98d6f56464549a2c8b4f9e3aea01f Mon Sep 17 00:00:00 2001 From: Lucas Moura Date: Thu, 6 Aug 2015 11:58:56 -0300 Subject: [PATCH] Create test for signals on colab.plugins.utils --- colab/plugins/utils/tests/__init__.py | 0 colab/plugins/utils/tests/test_signals.py | 20 ++++++++++++++++++++ colab/signals/tests/test_signals.py | 1 - 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 colab/plugins/utils/tests/__init__.py create mode 100644 colab/plugins/utils/tests/test_signals.py diff --git a/colab/plugins/utils/tests/__init__.py b/colab/plugins/utils/tests/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/colab/plugins/utils/tests/__init__.py diff --git a/colab/plugins/utils/tests/test_signals.py b/colab/plugins/utils/tests/test_signals.py new file mode 100644 index 0000000..15f9a3a --- /dev/null +++ b/colab/plugins/utils/tests/test_signals.py @@ -0,0 +1,20 @@ +from django.test import TestCase +from mock import patch, MagicMock +from colab.plugins.utils import signals + + +class SignalsTest(TestCase): + @patch("colab.plugins.utils.signals.apps.get_app_configs") + def test_init_signals(self, mock_app): + method_name = 'test' + + app_mock = MagicMock() + + apps_list = ['a', 'b', app_mock] + + mock_app.return_value = apps_list + signals._init_signals(method_name) + + app_mock.test.assert_called_with(app_mock) + self.assertEqual(1, app_mock.test.call_count) + self.assertTrue(app_mock.test.called) diff --git a/colab/signals/tests/test_signals.py b/colab/signals/tests/test_signals.py index e150909..69b20b9 100644 --- a/colab/signals/tests/test_signals.py +++ b/colab/signals/tests/test_signals.py @@ -16,7 +16,6 @@ from ..exceptions import SignalDoesNotExist class SignalsTest(TestCase): def setUp(self): - django.setup() self.list_signal = ['a', 'b', 'c'] self.plugin_name = 'test_signal' -- libgit2 0.21.2