Hi,
I tried writing tests in the web/pgadmin/tools/sqleditor/utils/tests/test_save_query_to_file_utils
for the file web/pgadmin/tools/sqleditor/utils/tests/save_query_to_file_utils.py
But I am getting a error,
ERROR: runTest (pgadmin.tools.sqleditor.utils.tests.test_save_query_to_file_utils.TestSaveQueryToFile)
When user has entered the extension .sql to the file while saving
----------------------------------------------------------------------
Traceback (most recent call last):
File "/var/www/flask/pgadmin4/pgadmin4/web/pgadmin/tools/sqleditor/utils/tests/test_save_query_to_file_utils.py", line 42, in runTest
file_path_result = save_query_to_file(self.file_data)
File "/var/www/flask/pgadmin4/pgadmin4/web/pgadmin/tools/sqleditor/utils/save_query_to_file_utils.py", line 15, in save_query_to_file
storage_manager_path = get_storage_directory()
File "/var/www/flask/pgadmin4/local/lib/python2.7/site-packages/flask_login.py", line 788, in decorated_view
if current_app.login_manager._login_disabled:
File "/var/www/flask/pgadmin4/local/lib/python2.7/site-packages/werkzeug/local.py", line 338, in __getattr__
return getattr(self._get_current_object(), name)
File "/var/www/flask/pgadmin4/local/lib/python2.7/site-packages/werkzeug/local.py", line 297, in _get_current_object
return self.__local()
File "/var/www/flask/pgadmin4/local/lib/python2.7/site-packages/flask/globals.py", line 51, in _find_app
raise RuntimeError(_app_ctx_err_msg)
RuntimeError: Working outside of application context.
How do I test the extracted code inside context? How do I resolve this error.
I have attached test_save_query_to_file_utils.py
and save_query_to_file_utils.py
Murtuza, Actually I didnt find any toggable button in the File Dialog Box So I made it general purpose ( I guess I will have to make one then and then if I select SQL all .sql files should be listed, and if I select All files then every type of file is shown in the File Dialog Box,this will be a new feature, wouldnt it ? )