From a8274b633a62262e65c7d013e61a54541ce07bf8 Mon Sep 17 00:00:00 2001 From: Duda Dornelles Date: Thu, 22 Jan 2015 10:25:40 -0200 Subject: #224 renaming tests so they get caught by trial runner --- service/test/unit/config/app_factory_test.py | 32 ---------------------------- service/test/unit/config/test_app_factory.py | 32 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 32 deletions(-) delete mode 100644 service/test/unit/config/app_factory_test.py create mode 100644 service/test/unit/config/test_app_factory.py (limited to 'service/test/unit/config') diff --git a/service/test/unit/config/app_factory_test.py b/service/test/unit/config/app_factory_test.py deleted file mode 100644 index a42c7c83..00000000 --- a/service/test/unit/config/app_factory_test.py +++ /dev/null @@ -1,32 +0,0 @@ -import unittest - -from mock import patch, MagicMock, ANY -import pixelated -from pixelated.config.app_factory import create_app - - -class AppFactoryTest(unittest.TestCase): - - class MockConfig: - def __init__(self, port, host, sslkey=None, sslcert=None): - self.port = port - self.host = host - self.sslkey = sslkey - self.sslcert = sslcert - - @patch('pixelated.config.app_factory.reactor') - def test_that_create_app_binds_to_tcp_port_if_no_ssl_options(self, reactor_mock): - app_mock = MagicMock() - - create_app(app_mock, AppFactoryTest.MockConfig(12345, '127.0.0.1')) - - reactor_mock.listenTCP.assert_called_once_with(12345, ANY, interface='127.0.0.1') - - @patch('pixelated.config.app_factory.reactor') - def test_that_create_app_binds_to_ssl_if_ssl_options(self, reactor_mock): - app_mock = MagicMock() - pixelated.config.app_factory._ssl_options = lambda _: 'options' - - create_app(app_mock, AppFactoryTest.MockConfig(12345, '127.0.0.1', sslkey="sslkey", sslcert="sslcert")) - - reactor_mock.listenSSL.assert_called_once_with(12345, ANY, 'options', interface='127.0.0.1') diff --git a/service/test/unit/config/test_app_factory.py b/service/test/unit/config/test_app_factory.py new file mode 100644 index 00000000..a42c7c83 --- /dev/null +++ b/service/test/unit/config/test_app_factory.py @@ -0,0 +1,32 @@ +import unittest + +from mock import patch, MagicMock, ANY +import pixelated +from pixelated.config.app_factory import create_app + + +class AppFactoryTest(unittest.TestCase): + + class MockConfig: + def __init__(self, port, host, sslkey=None, sslcert=None): + self.port = port + self.host = host + self.sslkey = sslkey + self.sslcert = sslcert + + @patch('pixelated.config.app_factory.reactor') + def test_that_create_app_binds_to_tcp_port_if_no_ssl_options(self, reactor_mock): + app_mock = MagicMock() + + create_app(app_mock, AppFactoryTest.MockConfig(12345, '127.0.0.1')) + + reactor_mock.listenTCP.assert_called_once_with(12345, ANY, interface='127.0.0.1') + + @patch('pixelated.config.app_factory.reactor') + def test_that_create_app_binds_to_ssl_if_ssl_options(self, reactor_mock): + app_mock = MagicMock() + pixelated.config.app_factory._ssl_options = lambda _: 'options' + + create_app(app_mock, AppFactoryTest.MockConfig(12345, '127.0.0.1', sslkey="sslkey", sslcert="sslcert")) + + reactor_mock.listenSSL.assert_called_once_with(12345, ANY, 'options', interface='127.0.0.1') -- cgit v1.2.3