def test_get_enterprise_app_endpoints(self, mock_get_service_endpoint):

        svc = CatalogSvc(
            BllRequest(operation='get_enterprise_app_endpoints',
                       auth_token=get_mock_token()))
        output = svc.handle()
        self.assertGreater(len(output['data']), 0)
    def test_get_plugins(self, _):

        request = {'target': 'catalog', 'data': {'operation': 'get_plugins'}}

        catalog_service = CatalogSvc(bll_request=BllRequest(request))
        reply = catalog_service.handle()
        self.assertEqual('complete', reply[api.STATUS])
        plugins = reply[api.DATA]
        self.assertIn('general', plugins)
        self.assertNotIn('unavailable', plugins)
 def test_monasca_transform_notavail(self, mock_serv, mock_conf):
     mon_comps = None
     mock_conf.return_value = mon_comps
     mock_serv.return_value = []
     request = {
         'target': 'catalog',
         'data': {
             'operation': 'get_plugins'
         },
         'auth_token': get_mock_token()
     }
     svc = CatalogSvc(bll_request=BllRequest(request))
     data = svc.handle()[api.DATA]
     self.assertNotIn('monasca-transform', data)
 def _test_get_swift_clusters(self):
     request = {
         'target': 'catalog',
         'data': {
             'operation': 'get_swift_clusters'
         },
         'auth_token': get_mock_token()
     }
     svc = CatalogSvc(bll_request=BllRequest(request))
     data = svc.handle()[api.DATA]
     self.assertTrue('ccp:cluster1' in data)
     self.assertEqual(len(data['ccp:cluster1']), 4)
     self.assertTrue('standard-ccp-c1-m1-mgmt' in data['ccp:cluster1'])
     self.assertTrue('some_host' in data['ccp:cluster1'])
 def _test_get_compute_clusters(self):
     request = {
         'target': 'catalog',
         'data': {
             'operation': 'get_compute_clusters'
         },
         'auth_token': get_mock_token()
     }
     svc = CatalogSvc(bll_request=BllRequest(request))
     data = svc.handle()[api.DATA]
     self.assertTrue('ccp:compute' in data)
     self.assertEqual(len(data['ccp:compute']), 2)
     self.assertTrue('standard-ccp-comp0001-mgmt' in data['ccp:compute'])
     self.assertTrue(
         'standard-ccp-comp0003-mgmt' not in data['ccp:compute'])
    def test_get_regions(self):

        token = get_token_from_env()

        request = {
            'target': 'catalog',
            'data': {
                'operation': 'get_regions'
            },
            'auth_token': token
        }

        catalog_service = CatalogSvc(bll_request=BllRequest(request))
        reply = catalog_service.handle()
        self.assertEqual('complete', reply[api.STATUS])
        regions = reply[api.DATA]
        self.assertGreater(len(regions), 0)
        self.assertEqual('region1', regions[0]['id'])
    def test_get_real_plugins(self):

        token = get_token_from_env()

        request = {
            'target': 'catalog',
            'data': {
                'operation': 'get_plugins'
            },
            'auth_token': token
        }

        catalog_service = CatalogSvc(bll_request=BllRequest(request))
        reply = catalog_service.handle()
        self.assertEqual('complete', reply[api.STATUS])
        plugins = reply[api.DATA]
        # print plugins
        self.assertIn('general', plugins)
        self.assertNotIn('unavailable', plugins)
    def test_get_services(self):

        token = get_token_from_env()

        request = {
            'target': 'catalog',
            'data': {
                'operation': 'get_services'
            },
            'auth_token': token
        }

        catalog_service = CatalogSvc(bll_request=BllRequest(request))
        reply = catalog_service.handle()
        self.assertEqual('complete', reply[api.STATUS])
        services = reply[api.DATA]
        self.assertGreater(len(services), 2)
        self.assertIn('identity', services)
        self.assertIn('keystone', services)
        self.assertIn('monitoring', services)