def test_apply_network_settings(self): ''' Test to apply global network configuration. ''' with patch.dict(rh_ip.__salt__, {'service.restart': MagicMock(return_value=True)}): self.assertTrue(rh_ip.apply_network_settings())
def test_apply_network_settings(self): ''' Test to apply global network configuration. ''' with patch.dict(rh_ip.__salt__, {'service.restart': MagicMock(return_value=True)}): self.assertTrue(rh_ip.apply_network_settings())
def test_apply_network_settings(self): """ Test to apply global network configuration. """ # This should be pytest.mark.parametrize, when this gets ported to # pytest approach. This is just following previous patterns here. # Edge cases are 7 & 8 mock_service = create_autospec(service_mod.restart, return_value=True) for majorrelease, expected_service_name in ( (3, "network"), (7, "network"), (8, "NetworkManager"), (42, "NetworkManager"), ): with patch.dict(rh_ip.__salt__, {"service.restart": mock_service}), patch.dict( rh_ip.__grains__, {"osmajorrelease": majorrelease}, ): self.assertTrue(rh_ip.apply_network_settings()) mock_service.assert_called_with(expected_service_name)