Commit 8b84838e authored by juga's avatar juga
Browse files

Rename earlier_result_ts to earliest_bandwidth

parent 81b442bd
......@@ -124,7 +124,7 @@ def main(args, conf):
results = load_recent_results_in_datadir(
fresh_days, datadir, success_only=True)
if results:
earlier_result_ts = min([r.time for r in results])
earliest_bandwidth = min([r.time for r in results])
if len(results) < 1:
log.warning('No recent results, so not generating anything. (Have you '
'ran sbws scanner recently?)')
......@@ -134,7 +134,7 @@ def main(args, conf):
data_lines = scale_lines(args, data_lines)
scanner_started_ts = read_started_ts(conf)
if results:
header = V3BwHeader(earlier_result_ts=earlier_result_ts,
header = V3BwHeader(earliest_bandwidth=earliest_bandwidth,
scanner_started_ts=scanner_started_ts)
else:
header = V3BwHeader(scanner_started_ts=scanner_started_ts)
......
......@@ -27,8 +27,8 @@ class V3BwHeader(object):
self.version = version
self.software = software
self.software_version = software_version
if kwargs.get('earlier_result_ts'):
self.earlier_result = kwargs['earlier_result_ts']
if kwargs.get('earliest_bandwidth'):
self.earliest_bandwidth = kwargs['earliest_bandwidth']
if kwargs.get('scanner_started_ts'):
self.scanner_started = kwargs['scanner_started_ts']
......
......@@ -12,12 +12,12 @@ def test_v3bwheader_str():
'software_version={}\n'.format(timestamp, version)
def test_v3bwheader_earlier_result_str():
"""Test header str with earlier_result"""
def test_v3bwheader_earliest_bandwidth_str():
"""Test header str with earliest_bandwidth"""
timestamp = 1524661857
earlier_result_ts = 1523887747.2904038
header = V3BwHeader(timestamp, earlier_result_ts=earlier_result_ts)
assert str(header) == '{}\nearlier_result=1523887747.2904038' \
earliest_bandwidth = 1523887747.2904038
header = V3BwHeader(timestamp, earliest_bandwidth=earliest_bandwidth)
assert str(header) == '{}\nearliest_bandwidth=1523887747.2904038' \
'{}\nversion=1.1.0\nsoftware=sbws\n' \
'software_version={}\n'.format(timestamp, version)
......@@ -32,12 +32,12 @@ def test_v3bwheader_scanner_started_str():
'software_version={}\n'.format(timestamp, version)
def test_v3bwheader_earlier_result_str():
"""Test header str with earlier_result"""
def test_v3bwheader_earliest_bandwidth_str():
"""Test header str with earliest_bandwidth"""
timestamp = 1524661857
earlier_result_ts = 1523887747.2904038
header = V3BwHeader(timestamp, earlier_result_ts=earlier_result_ts)
assert str(header) == '{}\nearlier_result=1523887747.2904038 ' \
earliest_bandwidth = 1523887747.2904038
header = V3BwHeader(timestamp, earliest_bandwidth=earliest_bandwidth)
assert str(header) == '{}\nearliest_bandwidth=1523887747.2904038 ' \
'software=sbws software_version=0.1.0 ' \
'timestamp=1524661857 version=1.1.0\n'.format(timestamp)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment