Skip to content

Commit

Permalink
Fixes netbox-community#13666: Fix behavior for reports without test m…
Browse files Browse the repository at this point in the history
…ethods
  • Loading branch information
JCWasmx86 committed Sep 26, 2023
1 parent 952be24 commit 1be871b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 0 additions & 2 deletions netbox/extras/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ def __init__(self):
'failure': 0,
'log': [],
}
if not test_methods:
raise Exception("A report must contain at least one test method.")
self.test_methods = test_methods

@classproperty
Expand Down
12 changes: 10 additions & 2 deletions netbox/templates/extras/report_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,18 @@ <h5 class="card-header" id="module{{ module.pk }}">
</td>
{% else %}
<td class="text-muted">{% trans "Never" %}</td>
<td>{{ ''|placeholder }}</td>
{% if report.test_methods|length %}
<td>{{ ''|placeholder }}</td>
{% else %}
<td>
<span class="alert-warning" role="alert">
A report must contain at least one test method.
</span>
</td>
{% endif %}
{% endif %}
<td>
{% if perms.extras.run_report %}
{% if perms.extras.run_report and report.test_methods|length %}
<div class="float-end noprint">
<form action="{% url 'extras:report' module=report.module name=report.class_name %}" method="post">
{% csrf_token %}
Expand Down

0 comments on commit 1be871b

Please sign in to comment.