def test_ovo_should_create_retrieve_deleted_project(self): # Create project create_project_ovo = objects.Project(external_id='fake_external_id', status='ACTIVE') create_project_ovo.create(session=self.session) project_id = create_project_ovo.id self.assertFalse(create_project_ovo.deleted) self.assertEqual('ACTIVE', create_project_ovo.status) self.assertIsNone(create_project_ovo.deleted_at) self.assertIsNotNone(create_project_ovo.id) # Get project get1_project_ovo = objects.Project.get(entity_id=project_id) self.assertEqual('ACTIVE', get1_project_ovo.status) # Update project update_project_ovo = objects.Project(id=project_id, status='ERROR') update_project_ovo.save(session=self.session) # Get project get2_project_ovo = objects.Project.get(entity_id=project_id) self.assertEqual('ERROR', get2_project_ovo.status) # Delete project objects.Project.delete_entity_by_id(entity_id=project_id, external_project_id=None, session=self.session) self.assertRaises(exception.NotFound, objects.Project.get, entity_id=project_id, session=self.session)
def init(self): self.parsed_project_quotas_1 = { 'secrets': 101, 'orders': 102, 'containers': 103, 'consumers': 105, 'cas': 106 } self.parsed_project_quotas_2 = { 'secrets': 201, 'orders': 202, 'containers': 203, 'consumers': 205, 'cas': 206 } self.parsed_project_quotas_3 = { 'secrets': 301, 'containers': 303, 'consumers': 305 } project1 = objects.Project(external_id='11111') project1.create(session=self.session) self.project_id1 = project1.id self.external_id1 = project1.external_id project2 = objects.Project(external_id='2222') project2.create(session=self.session) self.project_id2 = project2.id self.external_id2 = project2.external_id project3 = objects.Project(external_id='3333') project3.create(session=self.session) self.project_id3 = project3.id self.external_id3 = project3.external_id
def test_ovo_find_by_external_project_id(self): external_id = 'fake2_external_id' project_ovo = objects.Project(external_id=external_id, status='ACTIVE') project_ovo.create(session=self.session) project = objects.Project.find_by_external_project_id( external_project_id=external_id, session=self.session) self.assertEqual(external_id, project.external_id)
def _create_project(self): external_id = 'keystone_project_id' + uuidutils.generate_uuid( dashed=True) project = objects.Project(external_id=external_id) project.create(session=self.session) return project