~gmb/maas/dont-powercheck-broken-nodes-bug-1402243

« back to all changes in this revision

Viewing changes to src/maasserver/views/tests/test_nodes.py

  • Committer: MaaS Lander
  • Author(s): Graham Binns
  • Date: 2014-12-09 15:50:49 UTC
  • mfrom: (3407.1.3 fix-ui-bug-1399676)
  • Revision ID: maas_lander-20141209155049-ifr4gzznonl846i2
[r=rvb][bug=1399676][author=gmb] Ensure that if a Node's pxe_mac is set, this is the MAC that will be displayed in the node listing. If pxe_mac is not set, the first of the Node's MAC addresses (by creation) will be displayed instead.

Show diffs side-by-side

added added

removed removed

Lines of Context:
555
555
            [node_to_dict(node) for node in nodes],
556
556
            json_obj)
557
557
 
 
558
    def test_node_list_displays_pxe_mac_if_available(self):
 
559
        node = factory.make_Node()
 
560
        [factory.make_MACAddress(node=node) for _ in range(3)]
 
561
        node.pxe_mac = node.macaddress_set.last()
 
562
        node.save()
 
563
 
 
564
        self.client_log_in()
 
565
        response = self.client.get(reverse('node-list'))
 
566
        document = fromstring(response.content)
 
567
        [mac_element] = document.xpath('//span[@data-field="mac"]')
 
568
        self.expectThat(mac_element.text, Equals(node.pxe_mac.mac_address))
 
569
 
558
570
    def test_view_node_displays_node_info(self):
559
571
        # The node page features the basic information about the node.
560
572
        self.client_log_in()