summaryrefslogtreecommitdiff
path: root/cloudinit/cmd/tests/test_main.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/cmd/tests/test_main.py')
-rw-r--r--cloudinit/cmd/tests/test_main.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/cloudinit/cmd/tests/test_main.py b/cloudinit/cmd/tests/test_main.py
index 1f5975b0..2e380848 100644
--- a/cloudinit/cmd/tests/test_main.py
+++ b/cloudinit/cmd/tests/test_main.py
@@ -4,6 +4,9 @@ from collections import namedtuple
import copy
import os
from io import StringIO
+from unittest import mock
+
+import pytest
from cloudinit.cmd import main
from cloudinit import safeyaml
@@ -162,4 +165,24 @@ class TestMain(FilesystemMockingTestCase):
for log in expected_logs:
self.assertIn(log, self.stderr.getvalue())
+
+class TestShouldBringUpInterfaces:
+ @pytest.mark.parametrize('cfg_disable,args_local,expected', [
+ (True, True, False),
+ (True, False, False),
+ (False, True, False),
+ (False, False, True),
+ ])
+ def test_should_bring_up_interfaces(
+ self, cfg_disable, args_local, expected
+ ):
+ init = mock.Mock()
+ init.cfg = {'disable_network_activation': cfg_disable}
+
+ args = mock.Mock()
+ args.local = args_local
+
+ result = main._should_bring_up_interfaces(init, args)
+ assert result == expected
+
# vi: ts=4 expandtab