~bjornt/maas/get-apt-proxy

« back to all changes in this revision

Viewing changes to src/maasserver/api/tests/test_machine.py

  • Committer: MAAS Lander
  • Author(s): Bjorn Tillenius
  • Date: 2017-05-18 09:34:30 UTC
  • mfrom: (6037.1.8 reset-network-config)
  • Revision ID: maas_lander-20170518093430-k24mldj0ailtdiyh
Tags: 2.2.0
[r=mpontillo][bug=1687420][author=bjornt] When resetting the network configuration over the API, remove all
network interfaces that weren't detected during commissioning.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2128
2128
    def test_restore_networking_configuration(self):
2129
2129
        self.become_admin()
2130
2130
        machine = factory.make_Machine(status=NODE_STATUS.READY)
 
2131
        mock_restore_network_interfaces = self.patch(
 
2132
            node_module.Machine, 'restore_network_interfaces')
2131
2133
        mock_set_initial_networking_config = self.patch(
2132
2134
            node_module.Machine, 'set_initial_networking_configuration')
2133
2135
        response = self.client.post(
2137
2139
        self.assertEqual(
2138
2140
            machine.system_id, json_load_bytes(response.content)['system_id'])
2139
2141
        self.assertThat(mock_set_initial_networking_config, MockCalledOnce())
 
2142
        self.assertThat(mock_restore_network_interfaces, MockCalledOnce())
2140
2143
 
2141
2144
    def test_restore_networking_configuration_requires_admin(self):
2142
2145
        machine = factory.make_Machine()
2212
2215
        machine = factory.make_Machine(status=NODE_STATUS.READY)
2213
2216
        mock_set_default_storage_layout = self.patch(
2214
2217
            node_module.Machine, 'set_default_storage_layout')
 
2218
        mock_restore_network_interfaces = self.patch(
 
2219
            node_module.Machine, 'restore_network_interfaces')
2215
2220
        mock_set_initial_networking_config = self.patch(
2216
2221
            node_module.Machine, 'set_initial_networking_configuration')
2217
2222
        response = self.client.post(
2221
2226
        self.assertEqual(
2222
2227
            machine.system_id, json_load_bytes(response.content)['system_id'])
2223
2228
        self.assertThat(mock_set_default_storage_layout, MockCalledOnce())
 
2229
        self.assertThat(mock_restore_network_interfaces, MockCalledOnce())
2224
2230
        self.assertThat(mock_set_initial_networking_config, MockCalledOnce())
2225
2231
 
2226
2232
    def test_restore_default_configuration_requires_admin(self):