Пример #1
0
    def testIsConfigured(self):
        vm = VM({'id': None, 'name': None})

        self.assertFalse(vm.isConfigured())
        self.assertTrue(vm.isConfigured(True))
        self.assertEqual(vm.status, 'configured')

        self.assertFalse(vm.isConfigured(False))
        self.assertEqual(vm.status, 'new')
Пример #2
0
    def testUpdate(self):
        vm = VM({'id': None, 'name': None})

        expected = {'test': {}}
        vm.update(keys = expected)
        self.assertEqual(vm.keys, expected, "VM keys do not match expected value.")

        '''This test makes sure __setattr__ will not assign data to invalid attributes.'''
        vm.update(invalid = "derp")
        with self.assertRaises(AttributeError):
            vm.invalid