def test_constructor(self): """test constructor and self attributes after the call""" config = { 'get_novaclient.return_value': 'fake_nova_client', 'get_session.return_value.get_project_id.return_value': 'id' } osclients = MagicMock(**config) nova_resources = NovaResources(osclients) self.assertEquals(nova_resources.osclients, osclients) self.assertEquals(nova_resources.novaclient, 'fake_nova_client') self.assertEquals(nova_resources.tenant_id, 'id')
def setUp(self): """create and object and fill the fields with mocks""" osclients = MagicMock() self.nova_resources = NovaResources(osclients) self.nova_resources.novaclient = MagicMock(name='novaclient') self.nova_resources.tenant_id = 'tenant_id'