From 0587958125cf6d85479d76890e4e9414987aa6c5 Mon Sep 17 00:00:00 2001 From: voisardf Date: Mon, 27 Nov 2023 17:20:40 +0100 Subject: [PATCH] first part of test improvments --- .../sources/test_hook_methods.py | 47 ------------------- 1 file changed, 47 deletions(-) diff --git a/tests/contrib.data_sources.interlis_2_3/sources/test_hook_methods.py b/tests/contrib.data_sources.interlis_2_3/sources/test_hook_methods.py index 553df527f5..a68e874310 100644 --- a/tests/contrib.data_sources.interlis_2_3/sources/test_hook_methods.py +++ b/tests/contrib.data_sources.interlis_2_3/sources/test_hook_methods.py @@ -185,50 +185,3 @@ def query(self, term): yield Session - -def test_get_symbol_binary_content(theme_config, one_result_binary_session, png_binary): - with patch( - 'pyramid_oereb.core.adapter.DatabaseAdapter.get_session', - return_value=one_result_binary_session()): - body, content_type = get_symbol({'identifier': "1"}, theme_config) - assert content_type == 'image/png' - assert body == b64.decode(binascii.b2a_base64(png_binary).decode('ascii')) - - -def test_get_symbol_no_symbol_content(theme_config, one_result_no_symbol_session): - with patch( - 'pyramid_oereb.core.adapter.DatabaseAdapter.get_session', - return_value=one_result_no_symbol_session()): - with pytest.raises(HTTPServerError): - get_symbol({'identifier': "1"}, theme_config) - - -def test_get_symbol_wrong_param(theme_config, one_result_no_symbol_session): - with patch( - 'pyramid_oereb.core.adapter.DatabaseAdapter.get_session', - return_value=one_result_no_symbol_session()): - with pytest.raises(HTTPServerError): - get_symbol({'identif': "1"}, theme_config) - - -def test_get_symbol_no_legend_entry(theme_config, no_result_session): - with patch( - 'pyramid_oereb.core.adapter.DatabaseAdapter.get_session', - return_value=no_result_session()): - with pytest.raises(HTTPNotFound): - get_symbol({'identifier': "2"}, theme_config) - - -def test_get_symbol_wrong_content(theme_config, one_result_wrong_content_session): - with patch('pyramid_oereb.core.adapter.DatabaseAdapter.get_session', - return_value=one_result_wrong_content_session()): - with pytest.raises(HTTPServerError): - get_symbol({'identifier': "1"}, theme_config) - - -def test_get_symbol_b64_content(theme_config, one_result_b64_session, png_binary): - with patch('pyramid_oereb.core.adapter.DatabaseAdapter.get_session', - return_value=one_result_b64_session()): - body, content_type = get_symbol({'identifier': "1"}, theme_config) - assert content_type == 'image/png' - assert body == b64.decode(binascii.b2a_base64(png_binary).decode('ascii'))