Skip to content
This repository has been archived by the owner on Oct 24, 2021. It is now read-only.

Commit

Permalink
fix a test and remove some superfluous print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
jantman committed Jun 19, 2014
1 parent 1e32ebb commit f0f1a14
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion pypuppetdb_daily_report/pypuppetdb_daily_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,6 @@ def aggregate_data_for_timespan(data):
res['reports']['run_time_max'] = data['nodes'][node]['reports']['run_time_max']

# resource counts across all nodes
print("doing node {n}".format(n=node))
if 'resources' in data['nodes'][node]:
for key in ['failed', 'changed', 'skipped']:
if key in data['nodes'][node]['resources']:
Expand Down
1 change: 0 additions & 1 deletion pypuppetdb_daily_report/tests/pdr_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,6 @@ def test_basic(self):
assert tmpl_mock.render.call_count == 1
assert node_mock.call_count == 1
assert getuser_mock.call_count == 1
print(tmpl_mock.render.call_args)
assert tmpl_mock.render.call_args == mock.call(data=self.data,
dates=self.dates,
hostname='foo.example.com',
Expand Down
8 changes: 5 additions & 3 deletions pypuppetdb_daily_report/tests/test_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def test_changes(self):
end_date = datetime.datetime(2014, 6, 10, hour=23, minute=59, second=59, tzinfo=pytz.utc)

html, stripped = get_html(self.template_name, tmp_src_mock, data, dates, hostname, start_date, end_date)
write_debug(html, stripped)
#write_debug(html, stripped)

assert '<h3>Top Resource Changes, by Number of Nodes with Change</h3>' in html
assert '<tr><th>&nbsp;</th><th>Tue 06/10</th><th>Mon 06/09</th><th>Sun 06/08</th><th>Sat 06/07</th><th>Fri 06/06</th><th>Thu 06/05</th><th>Wed 06/04</th></tr>' in html
Expand All @@ -272,9 +272,11 @@ def test_changes(self):
lines.append('<tr><th>Service[zookeeper-server]</th><td>2(33%)</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>')
lines.append('<tr><th>Exec[zookeeperensemblecheck]</th><td>1(17%)</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>')
lines.append('</table>')
all_lines = ''
for line in lines:
assert line in stripped
assert ''.join(lines) in stripped
all_lines += line
assert all_lines in stripped

def test_failed(self):
sg = SourceGetter(self.template_name)
Expand All @@ -287,7 +289,7 @@ def test_failed(self):
end_date = datetime.datetime(2014, 6, 10, hour=23, minute=59, second=59, tzinfo=pytz.utc)

html, stripped = get_html(self.template_name, tmp_src_mock, data, dates, hostname, start_date, end_date)
write_debug(html, stripped)
#write_debug(html, stripped)

assert '<h3>Top Resource Failures, by Number of Nodes with Failure</h3>' in html
assert '<tr><th>&nbsp;</th><th>Tue 06/10</th><th>Mon 06/09</th><th>Sun 06/08</th><th>Sat 06/07</th><th>Fri 06/06</th><th>Thu 06/05</th><th>Wed 06/04</th></tr>' in html
Expand Down

0 comments on commit f0f1a14

Please sign in to comment.