示例#1
0
 def test_facet_policy(self):
     request = unit_test_utils.get_fake_request()
     search_repo = mock.Mock()
     with mock.patch.object(self.enforcer, 'enforce') as mock_enforce:
         repo = policy.CatalogSearchRepoProxy(search_repo, request.context,
                                              self.enforcer)
         repo.facets()
         mock_enforce.assert_called_with(request.context, 'facets', {})
示例#2
0
 def test_plugin_policy(self):
     request = unit_test_utils.get_fake_request()
     search_repo = mock.Mock()
     with mock.patch.object(self.enforcer, 'enforce') as mock_enforce:
         repo = policy.CatalogSearchRepoProxy(search_repo, request.context,
                                              self.enforcer)
         repo.plugins_info()
         mock_enforce.assert_called_with(request.context,
                                         'search:plugins_info',
                                         request.context.policy_target)
 def get_catalog_search_repo(self, context):
     search_repo = searchlight.elasticsearch.CatalogSearchRepo(
         context, self.es_api)
     policy_search_repo = policy.CatalogSearchRepoProxy(
         search_repo, context, self.policy)
     return policy_search_repo