[tor-commits] [oonib/master] Pass report_id to get correct file path

art at torproject.org art at torproject.org
Mon May 9 17:57:02 UTC 2016


commit 1617489c7d6175e45153a79ee5b1bcbd227948b8
Author: Arturo Filastò <arturo at filasto.net>
Date:   Mon Feb 15 19:21:18 2016 +0100

    Pass report_id to get correct file path
---
 oonib/report/handlers.py  | 4 ++--
 oonib/test/test_report.py | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/oonib/report/handlers.py b/oonib/report/handlers.py
index b27a943..3e308e5 100644
--- a/oonib/report/handlers.py
+++ b/oonib/report/handlers.py
@@ -39,8 +39,8 @@ def report_file_name(archive_dir, report_details,
         report_id=report_id
     )
     report_file_template = "{iso8601_timestamp}-{test_name}-{report_id}-{probe_asn}-{probe_cc}-probe-0.2.0.{ext}"
-    if config.main.report_file_template:
-        report_file_template = config.main.report_file_template
+    if config.main.get('report_file_template'):
+        report_file_template = config.main['report_file_template']
     dst_filename = os.path.join(archive_dir, report_file_template.format(**keys))
     dst_dir = os.path.dirname(dst_filename)
     if not os.path.exists(dst_dir):
diff --git a/oonib/test/test_report.py b/oonib/test/test_report.py
index 55f78be..5e1712b 100644
--- a/oonib/test/test_report.py
+++ b/oonib/test/test_report.py
@@ -178,7 +178,7 @@ class TestReport(HandlerTestCase):
         response = yield self.request('/report/%s/close' % report_id, "POST")
 
         written_report_header['format'] = 'yaml'
-        written_report_path = report_file_name(".", written_report_header)
+        written_report_path = report_file_name(".", written_report_header, report_id)
         with open(written_report_path) as f:
             self.filenames.add(written_report_path)
             written_report = yaml.safe_load_all(f)





More information about the tor-commits mailing list