Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
6 changes: 5 additions & 1 deletion netbox/templates/extras/report.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
{% csrf_token %}
{% render_form form %}
<div class="float-end">
<button type="submit" name="_run" class="btn btn-primary">
<button type="submit" name="_run" class="btn btn-primary"
{% if not report.test_methods|length %}
disabled
{% endif %}
>
{% if report.result %}
<i class="mdi mdi-replay"></i> {% trans "Run Again" %}
{% else %}
Expand Down
10 changes: 8 additions & 2 deletions netbox/templates/extras/report_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,16 @@ <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>
Invalid (no test methods found)
</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