diff options
author | James Falcon <therealfalcon@gmail.com> | 2021-08-19 15:46:45 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-19 14:46:45 -0600 |
commit | 3e63025ab70763c19a6e8b6586b6d75b1232fd18 (patch) | |
tree | 96ce961b2e42fca96dd760fd495ac3ed58184936 /tests/unittests | |
parent | 0bf8d575dc91b68084ef4d88869ac719b23924d0 (diff) | |
download | vyos-cloud-init-3e63025ab70763c19a6e8b6586b6d75b1232fd18.tar.gz vyos-cloud-init-3e63025ab70763c19a6e8b6586b6d75b1232fd18.zip |
testing: Add missing mocks to test_vmware.py (#982)
Diffstat (limited to 'tests/unittests')
-rw-r--r-- | tests/unittests/test_datasource/test_vmware.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/unittests/test_datasource/test_vmware.py b/tests/unittests/test_datasource/test_vmware.py index 597db7c8..52f910b5 100644 --- a/tests/unittests/test_datasource/test_vmware.py +++ b/tests/unittests/test_datasource/test_vmware.py @@ -6,6 +6,10 @@ import base64 import gzip +import os + +import pytest + from cloudinit import dmi, helpers, safeyaml from cloudinit import settings from cloudinit.sources import DataSourceVMware @@ -16,7 +20,6 @@ from cloudinit.tests.helpers import ( populate_dir, ) -import os PRODUCT_NAME_FILE_PATH = "/sys/class/dmi/id/product_name" PRODUCT_NAME = "VMware7,1" @@ -56,6 +59,17 @@ runcmd: """ +@pytest.yield_fixture(autouse=True) +def common_patches(): + with mock.patch('cloudinit.util.platform.platform', return_value='Linux'): + with mock.patch.multiple( + 'cloudinit.dmi', + is_container=mock.Mock(return_value=False), + is_FreeBSD=mock.Mock(return_value=False) + ): + yield + + class TestDataSourceVMware(CiTestCase): """ Test common functionality that is not transport specific. |