From cbdc4b9ad9bdb20a4e0ad17f9d5af26147b771f9 Mon Sep 17 00:00:00 2001 From: adroullier Date: Thu, 19 Oct 2023 17:40:31 +0200 Subject: Adding script name to 'global_config' during application setup as '__script__' --- tests/test_scripts/test_prequest.py | 7 ++++++- tests/test_scripts/test_pserve.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/test_scripts/test_prequest.py b/tests/test_scripts/test_prequest.py index 2214f6350..97786ec83 100644 --- a/tests/test_scripts/test_prequest.py +++ b/tests/test_scripts/test_prequest.py @@ -234,10 +234,15 @@ class TestPRequestCommand(unittest.TestCase): self.assertEqual(self._out, [b'abc']) def test_command_method_configures_logging(self): - command = self._makeOne(['', 'development.ini', '/']) + command = self._makeOne(['', '--method=GET', 'development.ini', '/']) command.run() self.assertEqual(self.loader.calls[0]['op'], 'logging') + def test_command_script_name(self): + command = self._makeOne(['', '--method=GET', 'development.ini', '/'],) + command.run() + self.assertEqual(self.loader.calls[0]['defaults']['__script__'], 'prequest') + class Test_main(unittest.TestCase): def _callFUT(self, argv): diff --git a/tests/test_scripts/test_pserve.py b/tests/test_scripts/test_pserve.py index 5e5c28c7b..0b010692a 100644 --- a/tests/test_scripts/test_pserve.py +++ b/tests/test_scripts/test_pserve.py @@ -47,7 +47,7 @@ class TestPServeCommand(unittest.TestCase): self.loader.server = lambda x: x inst.run() - self.assertEqual(app.global_conf, {'a': '1', 'b': '2'}) + self.assertEqual(app.global_conf, {'a': '1', 'b': '2', '__script__': 'pserve'}) def test_original_ignore_files(self): msg = 'A change to "ignore_files" was detected' -- cgit v1.2.3 From 74d675cea04335a17600a65bee8e0b0c5ca058a7 Mon Sep 17 00:00:00 2001 From: adroullier Date: Tue, 24 Oct 2023 14:01:24 +0200 Subject: Fix 'tox -e lint' tests --- tests/test_scripts/test_prequest.py | 5 ++++- tests/test_scripts/test_pserve.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/test_scripts/test_prequest.py b/tests/test_scripts/test_prequest.py index 97786ec83..d13010d5b 100644 --- a/tests/test_scripts/test_prequest.py +++ b/tests/test_scripts/test_prequest.py @@ -241,7 +241,10 @@ class TestPRequestCommand(unittest.TestCase): def test_command_script_name(self): command = self._makeOne(['', '--method=GET', 'development.ini', '/'],) command.run() - self.assertEqual(self.loader.calls[0]['defaults']['__script__'], 'prequest') + self.assertEqual( + self.loader.calls[0]['defaults']['__script__'], + 'prequest' + ) class Test_main(unittest.TestCase): diff --git a/tests/test_scripts/test_pserve.py b/tests/test_scripts/test_pserve.py index 0b010692a..bdc225c5e 100644 --- a/tests/test_scripts/test_pserve.py +++ b/tests/test_scripts/test_pserve.py @@ -47,7 +47,10 @@ class TestPServeCommand(unittest.TestCase): self.loader.server = lambda x: x inst.run() - self.assertEqual(app.global_conf, {'a': '1', 'b': '2', '__script__': 'pserve'}) + self.assertEqual( + app.global_conf, + {'a': '1', 'b': '2', '__script__': 'pserve'} + ) def test_original_ignore_files(self): msg = 'A change to "ignore_files" was detected' -- cgit v1.2.3 From caa712662d79005854b8bb5870f5cbe2da7f3029 Mon Sep 17 00:00:00 2001 From: adroullier Date: Tue, 24 Oct 2023 14:34:21 +0200 Subject: Fix 'tox -e lint' tests --- tests/test_scripts/test_prequest.py | 5 ++--- tests/test_scripts/test_pserve.py | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/test_scripts/test_prequest.py b/tests/test_scripts/test_prequest.py index d13010d5b..4ff6cb34c 100644 --- a/tests/test_scripts/test_prequest.py +++ b/tests/test_scripts/test_prequest.py @@ -239,11 +239,10 @@ class TestPRequestCommand(unittest.TestCase): self.assertEqual(self.loader.calls[0]['op'], 'logging') def test_command_script_name(self): - command = self._makeOne(['', '--method=GET', 'development.ini', '/'],) + command = self._makeOne(['', '--method=GET', 'development.ini', '/']) command.run() self.assertEqual( - self.loader.calls[0]['defaults']['__script__'], - 'prequest' + self.loader.calls[0]['defaults']['__script__'], 'prequest' ) diff --git a/tests/test_scripts/test_pserve.py b/tests/test_scripts/test_pserve.py index bdc225c5e..a56f25597 100644 --- a/tests/test_scripts/test_pserve.py +++ b/tests/test_scripts/test_pserve.py @@ -48,8 +48,7 @@ class TestPServeCommand(unittest.TestCase): inst.run() self.assertEqual( - app.global_conf, - {'a': '1', 'b': '2', '__script__': 'pserve'} + app.global_conf, {'a': '1', 'b': '2', '__script__': 'pserve'} ) def test_original_ignore_files(self): -- cgit v1.2.3 From fd42b0c8d08f69f88e3728b1c1ff3f50071f4b30 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Sat, 27 Jan 2024 18:17:21 -0700 Subject: add changelog --- tests/test_paster.py | 1 + 1 file changed, 1 insertion(+) (limited to 'tests') diff --git a/tests/test_paster.py b/tests/test_paster.py index 09e3bb868..e787e6973 100644 --- a/tests/test_paster.py +++ b/tests/test_paster.py @@ -159,6 +159,7 @@ class Test_bootstrap(unittest.TestCase): result = self._callFUT('/foo/bar/myapp.ini', request) self.assertEqual(result['app'], self.app) self.assertEqual(result['root'], self.root) + self.assertEqual(self.get_app.kw['options']['__script__'], 'bootstrap') self.assertTrue('closer' in result) -- cgit v1.2.3