def setUp(self): super(TestWaitForAllocation, self).setUp() self.session = mock.Mock(spec=adapter.Adapter) self.session.default_microversion = '1.52' self.session.log = mock.Mock() self.fake = dict(FAKE, state='allocating', node_uuid=None) self.allocation = allocation.Allocation(**self.fake)
def test_basic(self): sot = allocation.Allocation() self.assertIsNone(sot.resource_key) self.assertEqual('allocations', sot.resources_key) self.assertEqual('/allocations', sot.base_path) self.assertTrue(sot.allow_create) self.assertTrue(sot.allow_fetch) self.assertFalse(sot.allow_commit) self.assertTrue(sot.allow_delete) self.assertTrue(sot.allow_list)
def test_instantiate(self): sot = allocation.Allocation(**FAKE) self.assertEqual(FAKE['candidate_nodes'], sot.candidate_nodes) self.assertEqual(FAKE['created_at'], sot.created_at) self.assertEqual(FAKE['extra'], sot.extra) self.assertEqual(FAKE['last_error'], sot.last_error) self.assertEqual(FAKE['links'], sot.links) self.assertEqual(FAKE['name'], sot.name) self.assertEqual(FAKE['node_uuid'], sot.node_id) self.assertEqual(FAKE['resource_class'], sot.resource_class) self.assertEqual(FAKE['state'], sot.state) self.assertEqual(FAKE['traits'], sot.traits) self.assertEqual(FAKE['updated_at'], sot.updated_at) self.assertEqual(FAKE['uuid'], sot.id)