def setUp(self, enabled=None, create_req=False, enable_security=False): if not enabled: enabled = ['trac.*', 'bhsearch.*'] if not enable_security: disabled = ['bhsearch.security.*'] else: disabled = [] self.env = EnvironmentStub(enable=enabled, disable=disabled) self.env.path = tempfile.mkdtemp('bhsearch-tempenv') self.env.config.set('bhsearch', 'silence_on_error', "False") if create_req: self.req = Mock( perm=MockPerm(), chrome={ 'logo': {}, 'links': {} }, href=Href("/main"), base_path=BASE_PATH, path_info='/bhsearch', args=arg_list_to_args([]), authname='x', ) self.context = Mock(req=self.req) # Test without multiproduct. if hasattr(self.env, 'parent'): del self.env.parent
def setUp(self, enabled=None, create_req=False, enable_security=False): if not enabled: enabled = ['trac.*', 'bhsearch.*'] if not enable_security: disabled = ['bhsearch.security.*'] else: disabled = [] self.env = EnvironmentStub(enable=enabled, disable=disabled) self.env.path = tempfile.mkdtemp('bhsearch-tempenv') self.env.config.set('bhsearch', 'silence_on_error', "False") if create_req: self.req = Mock( perm=MockPerm(), chrome={'logo': {}, 'links': {}}, href=Href("/main"), base_path=BASE_PATH, path_info='/bhsearch', args=arg_list_to_args([]), authname='x', ) self.context = Mock(req=self.req) # Test without multiproduct. if hasattr(self.env, 'parent'): del self.env.parent
def _query_link(self, req, name, value, text=None): """Return a link to /query with the appropriate name and value""" default_query = self.crashlink_query.lstrip('?') args = arg_list_to_args(parse_arg_list(default_query)) args[name] = value if name == 'resolution': args['status'] = 'closed' return tag.a(text or value, href=req.href.query(args))
def setUp(self): self.req = Mock( perm=MockPerm(), chrome={'logo': {}}, href=Href("/main"), base_path=BASE_PATH, args=arg_list_to_args([]), )
def setUp(self, enabled = None, create_req = False): if not enabled: enabled = ['trac.*', 'bhsearch.*'] self.env = EnvironmentStub(enable=enabled) self.env.path = tempfile.mkdtemp('bhsearch-tempenv') self.env.config.set('bhsearch', 'silence_on_error', "False") if create_req: self.req = Mock( perm=MockPerm(), chrome={'logo': {}}, href=Href("/main"), base_path=BASE_PATH, args=arg_list_to_args([]), )
def setUp(self): self.env = EnvironmentStub(enable=['bhsearch.*']) current_current_dir = os.getcwd() real_env_path = os.path.join( current_current_dir, "../../../installer/bloodhound/environments/main") self.env.path = real_env_path self.whoosh_backend = WhooshBackend(self.env) self.req = Mock( perm=MockPerm(), chrome={'logo': {}}, href=Href("/main"), args=arg_list_to_args([]), )
def setUp(self): super(WebUiTestCaseWithWhoosh, self).setUp( create_req=True, ) self.req.redirect = self.redirect whoosh_backend = WhooshBackend(self.env) whoosh_backend.recreate_index() self.req = Mock( perm=MockPerm(), chrome={'logo': {}}, href=Href("/main"), base_path=BASE_PATH, args=arg_list_to_args([]), redirect=self.redirect ) self.redirect_url = None self.redirect_permanent = None