diff options
author | Jason Zions (MSFT) <jasonzio@microsoft.com> | 2019-04-18 21:23:36 +0000 |
---|---|---|
committer | Server Team CI Bot <josh.powers+server-team-bot@canonical.com> | 2019-04-18 21:23:36 +0000 |
commit | c8c32515778983d244126d4e359be9e91b3ce9e5 (patch) | |
tree | 81ccd800b9223ff36f9e6a7fe18589ae10e73caf /tests/unittests/test_datasource | |
parent | 947d3c20891815f164f4c7a8884d1f02ae4a9c5b (diff) | |
download | vyos-cloud-init-c8c32515778983d244126d4e359be9e91b3ce9e5.tar.gz vyos-cloud-init-c8c32515778983d244126d4e359be9e91b3ce9e5.zip |
test_azure: mock util.SeLinuxGuard where needed
Mock util.SeLinuxGuard to do nothing within tests that mock functions
used by the guard, when those mocks confuse the guard. This has no
impact when executing unit tests on systems which do not enable selinux
(e.g. Ubuntu).
LP: #1825253
Diffstat (limited to 'tests/unittests/test_datasource')
-rw-r--r-- | tests/unittests/test_datasource/test_azure.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/unittests/test_datasource/test_azure.py b/tests/unittests/test_datasource/test_azure.py index 53c56cd0..ab77c034 100644 --- a/tests/unittests/test_datasource/test_azure.py +++ b/tests/unittests/test_datasource/test_azure.py @@ -1375,12 +1375,15 @@ class TestCanDevBeReformatted(CiTestCase): self._domock(p + "util.mount_cb", 'm_mount_cb') self._domock(p + "os.path.realpath", 'm_realpath') self._domock(p + "os.path.exists", 'm_exists') + self._domock(p + "util.SeLinuxGuard", 'm_selguard') self.m_exists.side_effect = lambda p: p in bypath self.m_realpath.side_effect = realpath self.m_has_ntfs_filesystem.side_effect = has_ntfs_fs self.m_mount_cb.side_effect = mount_cb self.m_partitions_on_device.side_effect = partitions_on_device + self.m_selguard.__enter__ = mock.Mock(return_value=False) + self.m_selguard.__exit__ = mock.Mock() def test_three_partitions_is_false(self): """A disk with 3 partitions can not be formatted.""" |