コード例 #1
0
ファイル: tests.py プロジェクト: pombreda/ralph
 def test_get_services(self):
     service = utils.ServiceFactory()
     profit_center = utils.ProfitCenterFactory()
     utils.ServiceProfitCenterRelationFactory(
         parent=profit_center,
         child=service,
     )
     business_ownership = utils.ServiceOwnershipFactory.create_batch(
         2,
         ci=service,
         type=models_ci.CIOwnershipType.business,
     )
     technical_ownership = utils.ServiceOwnershipFactory.create_batch(
         3,
         ci=service,
         type=models_ci.CIOwnershipType.technical,
     )
     environments = utils.ServiceEnvironmentRelationFactory.create_batch(
         2,
         parent=service,
     )
     result = [a for a in api_scrooge.get_services()]
     service_dict = {
         'name': service.name,
         'ci_id': service.id,
         'ci_uid': service.uid,
         'symbol': None,
         'profit_center': profit_center.id,
         'business_owners': [bo.owner.id for bo in business_ownership],
         'technical_owners': [to.owner.id for to in technical_ownership],
         'environments': [e.child.id for e in environments],
     }
     self.assertEquals(result, [service_dict])
コード例 #2
0
ファイル: tests.py プロジェクト: pombreda/ralph
 def test_get_services_calc_in_scrooge(self):
     service = utils.ServiceFactory()
     utils.ServiceFactory()  # service not calculated in scrooge
     calc_in_scrooge_attr = models_ci.CIAttribute.objects.get(pk=7)
     service.ciattributevalue_set.create(attribute=calc_in_scrooge_attr,
                                         value=True)
     result = [a for a in api_scrooge.get_services(True)]
     service_dict = {
         'name': service.name,
         'ci_id': service.id,
         'ci_uid': service.uid,
         'symbol': None,
         'profit_center': None,
         'technical_owners': [],
         'business_owners': [],
         'environments': [],
     }
     self.assertEquals(result, [service_dict])
コード例 #3
0
ファイル: tests.py プロジェクト: pombreda/ralph
 def test_get_services_without_profit_center(self):
     service = utils.ServiceFactory()
     result = [a for a in api_scrooge.get_services()]
     service_dict = {
         'name': service.name,
         'ci_id': service.id,
         'ci_uid': service.uid,
         'symbol': None,
         'profit_center': None,
         'technical_owners': [],
         'business_owners': [],
         'environments': [],
     }
     self.assertEquals(result, [service_dict])