def test_gcp_not_vm(self): """ Test for the case, when the machine is host (not virtual machine) """ # We will mock facts using simple dictionary facts = { 'virt.is_guest': False, 'dmi.bios.version': 'cool hardware company' } gcp_detector = gcp.GCPCloudDetector(facts) is_vm = gcp_detector.is_vm() self.assertFalse(is_vm)
def test_vm_not_on_gcp_cloud(self): """ Test for the case, when the vm is not running on GCP """ # We will mock facts using simple dictionary facts = { 'virt.is_guest': True, 'virt.host_type': 'kvm', 'dmi.bios.version': '1.0', 'dmi.bios.vendor': 'Foo' } gcp_detector = gcp.GCPCloudDetector(facts) is_vm = gcp_detector.is_vm() self.assertTrue(is_vm) is_gcp_vm = gcp_detector.is_running_on_cloud() self.assertFalse(is_gcp_vm)