Index: sitescripts/filterhits/test/test_helpers.py |
diff --git a/multiplexer.fcgi b/sitescripts/filterhits/test/test_helpers.py |
old mode 100755 |
new mode 100644 |
similarity index 50% |
copy from multiplexer.fcgi |
copy to sitescripts/filterhits/test/test_helpers.py |
index d72b2c18a6d7e04b211354ec3a3e38895f74ed65..5c89b39632d034cd13cb8b4945b0192199a288ad |
--- a/multiplexer.fcgi |
+++ b/sitescripts/filterhits/test/test_helpers.py |
@@ -1,4 +1,3 @@ |
-#!/usr/bin/env python |
# coding: utf-8 |
# This file is part of the Adblock Plus web scripts, |
@@ -16,17 +15,25 @@ |
# You should have received a copy of the GNU General Public License |
# along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
-import os, re |
-from flup.server.fcgi import WSGIServer |
+import os |
-from sitescripts.web import multiplex |
+from sitescripts.utils import get_config |
-bindAddress = None |
-if 'FCGI_BIND_ADDRESS' in os.environ: |
- match = re.match(r'^(.*?):(\d+)$', os.environ['FCGI_BIND_ADDRESS']) |
- bindAddress = (match.group(1), int(match.group(2))) |
-srv = WSGIServer(multiplex, debug=False, bindAddress=bindAddress) |
+config = get_config() |
+live_config = { |
+ "database": config.get("filterhitstats", "database"), |
+ "log_dir": config.get("filterhitstats", "log_dir") |
+} |
+test_config = { |
+ "database": config.get("filterhitstats", "test_database"), |
+ "log_dir": os.path.join(os.path.dirname(__file__), "temp") |
+} |
-if __name__ == '__main__': |
- srv.run() |
+def setup_config(): |
+ config.set("filterhitstats", "database", test_config["database"]) |
+ config.set("filterhitstats", "log_dir", test_config["log_dir"]) |
Wladimir Palant
2015/03/30 13:13:46
Maybe create a real temporary directory rather tha
kzar
2015/03/30 15:14:53
Done.
|
+ return config |
+def restore_config(): |
+ config.set("filterhitstats", "database", live_config["database"]) |
+ config.set("filterhitstats", "log_dir", live_config["log_dir"]) |
Wladimir Palant
2015/03/30 13:13:46
Remove the temporary log directory here?
kzar
2015/03/30 15:14:53
Done.
|