Merge lp:~jtv/maas/commissioning-results-ui-tweaks into lp:~maas-committers/maas/trunk

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: no longer in the source branch.
Merged at revision: 1963
Proposed branch: lp:~jtv/maas/commissioning-results-ui-tweaks
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 358 lines (+105/-66)
6 files modified
src/maasserver/templates/metadataserver/nodecommissionresult.html (+8/-6)
src/maasserver/templates/metadataserver/nodecommissionresult_list.html (+33/-22)
src/maasserver/views/nodecommissionresult.py (+15/-1)
src/maasserver/views/nodes.py (+1/-9)
src/maasserver/views/tests/test_nodecommissionresults.py (+48/-12)
src/maasserver/views/tests/test_nodes.py (+0/-16)
To merge this branch: bzr merge lp:~jtv/maas/commissioning-results-ui-tweaks
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Review via email: mp+206732@code.launchpad.net

Commit message

Tweaks for the commissioning-results UI, as requested in previous review: indicate whether nodes listing is being filtered by node (and which), make leftmost column in listing (rather than rightmost) link to the details page, and make the "time" and "script result" fields on the details page less verbose.

Description of the change

These cover the remaining review notes from the original review for this UI: https://code.launchpad.net/~jtv/maas/show-commissioning-results/+merge/206661

We have functions similar to normalise_whitespace elsewhere. I figured it wasn't _quite_ worth centralising, given that "normalise" is a bit vague and only takes on meaning in the context of the module, but it's getting awfully close to that point where we want something reusable.

Jeroen

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) wrote :
Download full text (3.4 KiB)

Looks good. I have lots of comments, but they're mostly around the UI,
and not your changes. Pick out those ones that you want to fix; the rest
is just my commentary on the feature.

[1]

From IRC:

<jtv> allenap: if you want to play with the new feature, edit
  src/maasserver/views/nodes.py and change ENABLE_NODECOMMISSIONRESULTS
  to be True.

Why are we using feature flags in trunk?

[2]

+              {% if result_item.script_result == 0 %}
+              <span>OK: {{ result_item.script_result }}</span>
+              {% else %}

I know this probably comes under "systemtic UI review", but I don't
think this needs to include the return code. Just "OK" is enough.

+              <span class="warning">
+                <img src="{{ STATIC_URL }}img/warning.png" title="Failed" />
+                FAILED: {{ result_item.script_result }}
+              </span>
+              {% endif %}

Likewise, this doesn't need the return code (it ought to be on the
details page though).

[3]

On the details page, instead of having the 2-column thing at the top,
which takes up a lot of space without telling us much, how about
integrating it into the output:

  <breadcrumbs>
    Nodes > moon > Commissioning results > 00-maas-01-lshw.out
  </breadcrumbs>

  <heading>
    FAILED
  </heading>

  <output>
    <italics>
      Recorded 12:34 on February 17th, 2014.
    </italics>
    Error while installing lldp: Network unreachable.
    <italics>
      Exited 1
    </italics>
  </output>

Maybe that's no good either. I just know that I dislike that 2-column
layout; it's too sparse and light on useful information.

[4]

On http://localhost:5240/commissioning-results/?node=... I expected to
be able to click on the "/!\ FAILED" bit to see the logs.  If I had
wanted to see the logs from an "OK" result I would have wanted to click
in the same column; it is called "Script result" after all.

[4.1]

Same goes for http://localhost:5240/nodes/; I want to be able to click
the "Failed tests" status line or the warning triangle to see what's
wrong.

[4.2]

The URL http://localhost:5240/commissioning-results/?node=... is
slightly disorientating. It would be good to have a view under
/nodes/$id/ to show a page with that node's own results.

[5]

I'm also not sure I care what file it wrote to:
00-maas-02-virtuality.out means little to me, and I know the
implementation.

[6]

I'm also not sure the Node column is useful on that page. I see that
it's a general commissioning results page, narrowed to that particular
node, but I got there by finding "moon" then clicking "3 output files".
To be told that it's for node-29d7ad70-4671-11e1-93b8-00225f89f211 is
confusing. Once I understood, it was superfluous.

I guess it needs to be there when showing more than just a single node's
results, but it should then show the node's given name, rather than its
system-generated name.

[7]

On http://localhost:5240/nodes/.../view/ the "Commissioning output" cell
should probably show if commissioning failed too, but perhaps that's
coming later.

[8]

It's not a change you made, but the <pre> block for the output has
excess whitespace within it. <pre> is so anal that it's necessary to
foreg...

Read more...

review: Approve
Revision history for this message
Julian Edwards (julian-edwards) wrote :

On Monday 17 Feb 2014 15:59:06 you wrote:
> <jtv> allenap: if you want to play with the new feature, edit
> src/maasserver/views/nodes.py and change ENABLE_NODECOMMISSIONRESULTS
> to be True.
>
> Why are we using feature flags in trunk?

Let's get rid of the flag. The feature will be useful to people, even if it's
not polished to the shine of Gavin's head. We'll also get early feedback from
users before release time.

cheers.

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :
Download full text (5.8 KiB)

> Looks good. I have lots of comments, but they're mostly around the UI,
> and not your changes. Pick out those ones that you want to fix; the rest
> is just my commentary on the feature.

Thanks for going through it so thoroughly! I made lots of changes in response, and they brought me to the point where I'm confident enough to drop the feature flag.

> [1]
>
> From IRC:
>
> <jtv> allenap: if you want to play with the new feature, edit
>  src/maasserver/views/nodes.py and change ENABLE_NODECOMMISSIONRESULTS
>  to be True.
>
> Why are we using feature flags in trunk?

Because the change would have been much more contentious otherwise. It was a mad-dash personal initiative, not a carefully planned feature. Planned as a feature it would have taken longer, and therefore, been lower on the priority list and impossible to fit in before the sprint. As a mad dash, it was at risk of bogging down in design/review changes, and we might still have ended up getting something great later instead of something good now. The feature flag made it possible to land the initial branch and make changes later.

> [2]
>
> +              {% if result_item.script_result == 0 %}
> +              <span>OK: {{ result_item.script_result }}</span>
> +              {% else %}
>
> I know this probably comes under "systemtic UI review", but I don't
> think this needs to include the return code. Just "OK" is enough.

Exactly the sort of feedback I needed. Done.

> +              <span class="warning">
> +                <img src="{{ STATIC_URL }}img/warning.png" title="Failed" />
> +                FAILED: {{ result_item.script_result }}
> +              </span>
> +              {% endif %}
>
> Likewise, this doesn't need the return code (it ought to be on the
> details page though).

Also done.

> [3]
>
> On the details page, instead of having the 2-column thing at the top,
> which takes up a lot of space without telling us much, how about
> integrating it into the output:
>
>  <breadcrumbs>
>    Nodes > moon > Commissioning results > 00-maas-01-lshw.out
>  </breadcrumbs>
>
>  <heading>
>    FAILED
>  </heading>
>
>  <output>
>    <italics>
>      Recorded 12:34 on February 17th, 2014.
>    </italics>
>    Error while installing lldp: Network unreachable.
>    <italics>
>      Exited 1
>    </italics>
>  </output>
>
> Maybe that's no good either. I just know that I dislike that 2-column
> layout; it's too sparse and light on useful information.

I agree, but it's what we had available... Maybe we can have a proper redesign for this sometime after the sprint. It'd be nice if it didn't look quite so much like a Node page. For now though I hope this will remain a fairly obscure page.

> [4]
>
> On http://localhost:5240/commissioning-results/?node=... I expected to
> be able to click on the "/!\ FAILED" bit to see the logs.  If I had
> wanted to see the logs from an "OK" result I would have wanted to click
> in the same column; it is called "Script result" after all.

Ironically, that's what I had in my original branch. But Raphaël preferred the link on the left-hand column, so I changed it. And now I have a solution that I hope will ...

Read more...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/maasserver/templates/metadataserver/nodecommissionresult.html'
--- src/maasserver/templates/metadataserver/nodecommissionresult.html 2014-02-17 07:34:05 +0000
+++ src/maasserver/templates/metadataserver/nodecommissionresult.html 2014-02-18 04:37:34 +0000
@@ -19,19 +19,21 @@
19 </span>19 </span>
20 </li>20 </li>
21 <li class="block size7 first" id="time">21 <li class="block size7 first" id="time">
22 <h4>Time</h4>22 <h4>Result registered at</h4>
23 <span>Result was registered at {{ object.created }}</span>23 <span>{{ object.created }}</span>
24 </li>24 </li>
25 <li class="block size3" id="script-result">25 <li class="block size3" id="script-result">
26 <h4>Return value</h4>26 <h4>Script return value</h4>
27 <span>Script returned {{ object.script_result }}</span>27 <span>{{ object.script_result }}</span>
28 </li>28 </li>
2929
30 <li class="block first separate" id="output">30 <li class="block first separate" id="output">
31 {% if object.data %}
31 <h2>Output</h2>32 <h2>Output</h2>
32 <pre>33<pre>
33{{ object.get_data_as_html }}34{{ object.get_data_as_html }}
34 </pre>35</pre>
36 {% endif %}
35 </li>37 </li>
36 </ul>38 </ul>
3739
3840
=== modified file 'src/maasserver/templates/metadataserver/nodecommissionresult_list.html'
--- src/maasserver/templates/metadataserver/nodecommissionresult_list.html 2014-02-17 04:25:33 +0000
+++ src/maasserver/templates/metadataserver/nodecommissionresult_list.html 2014-02-18 04:37:34 +0000
@@ -1,6 +1,6 @@
1{% extends "maasserver/base.html" %}1{% extends "maasserver/base.html" %}
22
3{% block nav-active-zone-list %}active{% endblock %}3{% block nav-active-result-list %}active{% endblock %}
4{% block title %}Node commissioning results{% endblock %}4{% block title %}Node commissioning results{% endblock %}
5{% block page-title %}5{% block page-title %}
6{{ paginator.count }} result{{ paginator.count|pluralize }}6{{ paginator.count }} result{{ paginator.count|pluralize }}
@@ -12,41 +12,52 @@
1212
13{% block content %}13{% block content %}
14 <div id="results">14 <div id="results">
15 <h2>Commissioning results</h2>15 <h2 id="header">
16 Commissioning results
17 {% if nodes_filter %}
18 for {{ nodes_filter }}
19 {% endif %}
20 </h2>
16 {% if paginator.count == 0 %}21 {% if paginator.count == 0 %}
17 <p>No matching commissioning results.</p>22 <p>No matching commissioning results.</p>
18 {% else %}23 {% else %}
19 <table class="list">24 <table class="list">
20 <thead>25 <thead>
21 <tr>26 <tr>
22 <th>Time</th>27 <th>Script result</th>
28 <th>Output file</th>
29 <th>Registered at</th>
23 <th>Node</th>30 <th>Node</th>
24 <th>Output file</th>
25 <th>Script result<th>
26 </tr>31 </tr>
27 </thead>32 </thead>
28 <tbody>33 <tbody>
29 {% for result_item in results_list %}34 {% for result_item in results_list %}
30 <tr class="result {% cycle 'even' 'odd' %}">35 <tr class="result {% cycle 'even' 'odd' %}">
31 <td>{{ result_item.created }}</td>36 <!-- Script result -->
37 <td>
38 <a href="{% url 'nodecommissionresult-view' result_item.id %}">
39 {% if result_item.script_result == 0 %}
40 <span>OK</span>
41 {% else %}
42 <span class="warning">
43 <img src="{{ STATIC_URL }}img/warning.png" title="Failed" />
44 FAILED
45 </span>
46 {% endif %}
47 </a>
48 </td>
49 <!-- Output file -->
50 <td>
51 {{ result_item.name }}
52 </td>
53 <!-- Registered at -->
54 <td>
55 {{ result_item.created }}
56 </td>
57 <!-- Node -->
32 <td>58 <td>
33 <a href="{% url 'node-view' result_item.node.system_id %}">59 <a href="{% url 'node-view' result_item.node.system_id %}">
34 {{ result_item.node.system_id }}60 {{ result_item.node.hostname }}
35 </a>
36 </td>
37 <td>
38 {{ result_item.name }}
39 </td>
40 <td>
41 <a href="{% url 'nodecommissionresult-view' result_item.id %}">
42 {% if result_item.script_result == 0 %}
43 OK: {{ result_item.script_result }}
44 {% else %}
45 <span class="warning">
46 <img src="{{ STATIC_URL }}img/warning.png" title="Failed" />
47 FAILED: {{ result_item.script_result }}
48 </span>
49 {% endif %}
50 </a>61 </a>
51 </td>62 </td>
52 </tr>63 </tr>
5364
=== modified file 'src/maasserver/views/nodecommissionresult.py'
--- src/maasserver/views/nodecommissionresult.py 2014-02-17 12:28:55 +0000
+++ src/maasserver/views/nodecommissionresult.py 2014-02-18 04:37:34 +0000
@@ -18,6 +18,7 @@
1818
19from django.shortcuts import get_object_or_40419from django.shortcuts import get_object_or_404
20from django.views.generic import DetailView20from django.views.generic import DetailView
21from maasserver.models import Node
21from maasserver.views import PaginatedListView22from maasserver.views import PaginatedListView
22from metadataserver.models import NodeCommissionResult23from metadataserver.models import NodeCommissionResult
2324
@@ -27,9 +28,22 @@
27 template_name = 'maasserver/nodecommissionresult-list.html'28 template_name = 'maasserver/nodecommissionresult-list.html'
28 context_object_name = 'results_list'29 context_object_name = 'results_list'
2930
31 def get_filter_system_ids(self):
32 """Return the list of nodes that were selected for filtering."""
33 return self.request.GET.getlist('node')
34
35 def get_context_data(self, **kwargs):
36 context = super(NodeCommissionResultListView, self).get_context_data()
37 system_ids = self.get_filter_system_ids()
38 if system_ids is not None and len(system_ids) > 0:
39 nodes = Node.objects.filter(system_id__in=system_ids)
40 context['nodes_filter'] = ', '.join(
41 sorted(node.hostname for node in nodes))
42 return context
43
30 def get_queryset(self):44 def get_queryset(self):
31 results = NodeCommissionResult.objects.all()45 results = NodeCommissionResult.objects.all()
32 system_ids = self.request.GET.getlist('node')46 system_ids = self.get_filter_system_ids()
33 if system_ids is not None and len(system_ids) > 0:47 if system_ids is not None and len(system_ids) > 0:
34 results = results.filter(node__system_id__in=system_ids)48 results = results.filter(node__system_id__in=system_ids)
35 return results.order_by('node', '-created', 'name')49 return results.order_by('node', '-created', 'name')
3650
=== modified file 'src/maasserver/views/nodes.py'
--- src/maasserver/views/nodes.py 2014-02-13 10:29:27 +0000
+++ src/maasserver/views/nodes.py 2014-02-18 04:37:34 +0000
@@ -400,11 +400,6 @@
400""")400""")
401401
402402
403# Feature flag: link to node commissioning results?
404# XXX jtv 2014-02-13: Remove this when this UI feature is good enough.
405ENABLE_NODECOMMISSIONRESULTS = False
406
407
408class NodeView(NodeViewMixin, UpdateView):403class NodeView(NodeViewMixin, UpdateView):
409 """View class to display a node's information and buttons for the actions404 """View class to display a node's information and buttons for the actions
410 which can be performed on this node.405 which can be performed on this node.
@@ -447,10 +442,7 @@
447 context["probed_details"] = etree.tostring(442 context["probed_details"] = etree.tostring(
448 probed_details, encoding=unicode, pretty_print=True)443 probed_details, encoding=unicode, pretty_print=True)
449444
450 if ENABLE_NODECOMMISSIONRESULTS:445 results = NodeCommissionResult.objects.filter(node=node).count()
451 results = NodeCommissionResult.objects.filter(node=node).count()
452 else:
453 results = 0
454 context['nodecommissionresults'] = results446 context['nodecommissionresults'] = results
455447
456 return context448 return context
457449
=== modified file 'src/maasserver/views/tests/test_nodecommissionresults.py'
--- src/maasserver/views/tests/test_nodecommissionresults.py 2014-02-17 12:28:55 +0000
+++ src/maasserver/views/tests/test_nodecommissionresults.py 2014-02-18 04:37:34 +0000
@@ -30,6 +30,11 @@
30from testtools.matchers import HasLength30from testtools.matchers import HasLength
3131
3232
33def normalise_whitespace(text):
34 """Replace any whitespace sequence with just a single space."""
35 return ' '.join(text.split())
36
37
33class TestNodeCommissionResultView(MAASServerTestCase):38class TestNodeCommissionResultView(MAASServerTestCase):
3439
35 def request_page(self, result):40 def request_page(self, result):
@@ -72,7 +77,7 @@
72 result.node.hostname,77 result.node.hostname,
73 self.extract_field(doc, 'node'))78 self.extract_field(doc, 'node'))
74 self.assertEqual(79 self.assertEqual(
75 "Script returned %d" % result.script_result,80 "%d" % result.script_result,
76 self.extract_field(doc, 'script-result'))81 self.extract_field(doc, 'script-result'))
77 self.assertEqual(result.data, self.extract_field(doc, 'output', 'pre'))82 self.assertEqual(result.data, self.extract_field(doc, 'output', 'pre'))
7883
@@ -92,6 +97,13 @@
92 doc = self.request_page(result)97 doc = self.request_page(result)
93 self.assertEqual('A\ufffdB', self.extract_field(doc, 'output', 'pre'))98 self.assertEqual('A\ufffdB', self.extract_field(doc, 'output', 'pre'))
9499
100 def test_hides_output_if_empty(self):
101 self.client_log_in(as_admin=True)
102 result = factory.make_node_commission_result(data=b'')
103 doc = self.request_page(result)
104 field = get_one(doc.cssselect('#output'))
105 self.assertEqual('', field.text_content().strip())
106
95107
96class TestNodeCommissionResultListView(MAASServerTestCase):108class TestNodeCommissionResultListView(MAASServerTestCase):
97109
@@ -143,26 +155,23 @@
143 result_row = get_one(content.cssselect('.result'))155 result_row = get_one(content.cssselect('.result'))
144 fields = result_row.cssselect('td')156 fields = result_row.cssselect('td')
145157
146 [time, node, output_file, script_result] = fields158 [script_result, output_file, time, node] = fields
159 self.assertEqual('OK', script_result.text_content().strip())
147 self.assertIn('%d' % result.created.year, time.text_content())160 self.assertIn('%d' % result.created.year, time.text_content())
148 self.assertEqual(result.node.system_id, node.text_content().strip())161 self.assertEqual(result.node.hostname, node.text_content().strip())
149 self.assertEqual(162 self.assertEqual(
150 reverse('node-view', args=[result.node.system_id]),163 reverse('node-view', args=[result.node.system_id]),
151 get_one(node.cssselect('a')).get('href'))164 get_one(node.cssselect('a')).get('href'))
152 self.assertEqual(result.name, output_file.text_content().strip())165 self.assertEqual(result.name, output_file.text_content().strip())
153 self.assertEqual('OK: 0', script_result.text_content().strip())
154166
155 def test_shows_failure(self):167 def test_shows_failure(self):
156 self.client_log_in(as_admin=True)168 self.client_log_in(as_admin=True)
157 result = factory.make_node_commission_result(169 factory.make_node_commission_result(script_result=randint(1, 100))
158 script_result=randint(1, 100))
159 content = self.request_page()170 content = self.request_page()
160 result_row = get_one(content.cssselect('.result'))171 result_row = get_one(content.cssselect('.result'))
161 fields = result_row.cssselect('td')172 fields = result_row.cssselect('td')
162 [_, _, _, script_result] = fields173 [script_result, _, _, _] = fields
163 self.assertEqual(174 self.assertEqual("FAILED", script_result.text_content().strip())
164 "FAILED: %d" % result.script_result,
165 script_result.text_content().strip())
166 self.assertNotEqual([], script_result.find_class('warning'))175 self.assertNotEqual([], script_result.find_class('warning'))
167176
168 def test_links_to_result(self):177 def test_links_to_result(self):
@@ -172,7 +181,7 @@
172 content = self.request_page()181 content = self.request_page()
173 result_row = get_one(content.cssselect('.result'))182 result_row = get_one(content.cssselect('.result'))
174 fields = result_row.cssselect('td')183 fields = result_row.cssselect('td')
175 [_, _, _, script_result] = fields184 [script_result, _, _, _] = fields
176 link = get_one(script_result.cssselect('a'))185 link = get_one(script_result.cssselect('a'))
177 self.assertEqual(186 self.assertEqual(
178 reverse('nodecommissionresult-view', args=[result.id]),187 reverse('nodecommissionresult-view', args=[result.id]),
@@ -241,8 +250,35 @@
241 self.assertThat(rows, HasLength(len(matching_results)))250 self.assertThat(rows, HasLength(len(matching_results)))
242 matching_names = set()251 matching_names = set()
243 for row in rows:252 for row in rows:
244 [_, _, name, _] = row.cssselect('td')253 [_, name, _, _] = row.cssselect('td')
245 matching_names.add(name.text_content().strip())254 matching_names.add(name.text_content().strip())
246 self.assertEqual(255 self.assertEqual(
247 {result.name for result in matching_results},256 {result.name for result in matching_results},
248 matching_names)257 matching_names)
258
259 def test_does_not_show_node_if_not_filtering_by_node(self):
260 self.client_log_in(as_admin=True)
261 doc = self.request_page()
262 header = get_one(doc.cssselect('#header'))
263 self.assertEqual(
264 "Commissioning results",
265 normalise_whitespace(header.text_content()))
266
267 def test_shows_node_if_filtering_by_node(self):
268 self.client_log_in(as_admin=True)
269 node = factory.make_node()
270 doc = self.request_page(nodes=[node])
271 header = get_one(doc.cssselect('#header'))
272 self.assertEqual(
273 "Commissioning results for %s" % node.hostname,
274 normalise_whitespace(header.text_content()))
275
276 def test_shows_nodes_if_filtering_by_multiple_nodes(self):
277 self.client_log_in(as_admin=True)
278 names = [factory.make_name('node').lower() for _ in range(2)]
279 nodes = [factory.make_node(hostname=name) for name in names]
280 doc = self.request_page(nodes=nodes)
281 header = get_one(doc.cssselect('#header'))
282 self.assertEqual(
283 "Commissioning results for %s" % ', '.join(sorted(names)),
284 normalise_whitespace(header.text_content()))
249285
=== modified file 'src/maasserver/views/tests/test_nodes.py'
--- src/maasserver/views/tests/test_nodes.py 2014-02-13 10:53:27 +0000
+++ src/maasserver/views/tests/test_nodes.py 2014-02-18 04:37:34 +0000
@@ -951,11 +951,6 @@
951class NodeCommissionResultsDisplayTest(MAASServerTestCase):951class NodeCommissionResultsDisplayTest(MAASServerTestCase):
952 """Tests for the link to node commissioning results on the Node page."""952 """Tests for the link to node commissioning results on the Node page."""
953953
954 def enable_display(self):
955 """Enable the feature flag behind which this display is hidden."""
956 # XXX jtv 2014-02-13: Remove this once feature is good enough.
957 self.patch(nodes_views, 'ENABLE_NODECOMMISSIONRESULTS', True)
958
959 def request_results_display(self, node):954 def request_results_display(self, node):
960 """Request the page for `node`, and extract the results display.955 """Request the page for `node`, and extract the results display.
961956
@@ -1000,7 +995,6 @@
1000 return ' '.join(text.split())995 return ' '.join(text.split())
1001996
1002 def test_view_node_links_to_commissioning_results_if_appropriate(self):997 def test_view_node_links_to_commissioning_results_if_appropriate(self):
1003 self.enable_display()
1004 self.client_log_in(as_admin=True)998 self.client_log_in(as_admin=True)
1005 result = factory.make_node_commission_result()999 result = factory.make_node_commission_result()
1006 section = self.request_results_display(result.node)1000 section = self.request_results_display(result.node)
@@ -1010,26 +1004,17 @@
1010 results_list + '?node=%s' % result.node.system_id,1004 results_list + '?node=%s' % result.node.system_id,
1011 link.get('href'))1005 link.get('href'))
10121006
1013 def test_view_node_hides_commissioning_results_by_default(self):
1014 # XXX jtv 2014-02-13: Remove this test once we get rid of feature flag.
1015 self.client_log_in(as_admin=True)
1016 result = factory.make_node_commission_result()
1017 self.assertIsNone(self.request_results_display(result.node))
1018
1019 def test_view_node_shows_commissioning_results_only_if_present(self):1007 def test_view_node_shows_commissioning_results_only_if_present(self):
1020 self.enable_display()
1021 self.client_log_in(as_admin=True)1008 self.client_log_in(as_admin=True)
1022 node = factory.make_node()1009 node = factory.make_node()
1023 self.assertIsNone(self.request_results_display(node))1010 self.assertIsNone(self.request_results_display(node))
10241011
1025 def test_view_node_shows_commissioning_results_only_to_superuser(self):1012 def test_view_node_shows_commissioning_results_only_to_superuser(self):
1026 self.enable_display()
1027 self.client_log_in(as_admin=False)1013 self.client_log_in(as_admin=False)
1028 result = factory.make_node_commission_result()1014 result = factory.make_node_commission_result()
1029 self.assertIsNone(self.request_results_display(result.node))1015 self.assertIsNone(self.request_results_display(result.node))
10301016
1031 def test_view_node_shows_single_commissioning_result(self):1017 def test_view_node_shows_single_commissioning_result(self):
1032 self.enable_display()
1033 self.client_log_in(as_admin=True)1018 self.client_log_in(as_admin=True)
1034 result = factory.make_node_commission_result()1019 result = factory.make_node_commission_result()
1035 section = self.request_results_display(result.node)1020 section = self.request_results_display(result.node)
@@ -1039,7 +1024,6 @@
1039 self.normalise_whitespace(link.text_content()))1024 self.normalise_whitespace(link.text_content()))
10401025
1041 def test_view_node_shows_multiple_commissioning_results(self):1026 def test_view_node_shows_multiple_commissioning_results(self):
1042 self.enable_display()
1043 self.client_log_in(as_admin=True)1027 self.client_log_in(as_admin=True)
1044 node = factory.make_node()1028 node = factory.make_node()
1045 num_results = randint(2, 5)1029 num_results = randint(2, 5)