Пример #1
0
 def test_enable_boot_diagnostics_skip_when_enabled_already(self, mock_vm_set, mock_vm_get):
     vm_fake = mock.MagicMock()
     mock_vm_get.return_value = vm_fake
     vm_fake.diagnostics_profile.boot_diagnostics.enabled = True
     vm_fake.diagnostics_profile.boot_diagnostics.storage_uri = 'https://storage_uri1'
     enable_boot_diagnostics('g1', 'vm1', 'https://storage_uri1')
     self.assertTrue(mock_vm_get.called)
     self.assertFalse(mock_vm_set.called)
Пример #2
0
 def test_enable_boot_diagnostics_on_vm_never_enabled(self, mock_vm_set, mock_vm_get):
     vm_fake = mock.MagicMock()
     mock_vm_get.return_value = vm_fake
     enable_boot_diagnostics('g1', 'vm1', 'https://storage_uri1')
     self.assertTrue(vm_fake.diagnostics_profile.boot_diagnostics.enabled)
     self.assertEqual('https://storage_uri1',
                      vm_fake.diagnostics_profile.boot_diagnostics.storage_uri)
     self.assertTrue(mock_vm_get.called)
     mock_vm_set.assert_called_once_with(vm_fake, mock.ANY)