def setUp(self): super().setUp() # Used by CheckHttpErrors self.ignore_http_errors = False self.test_username = u"gui_user" webauth.WEBAUTH_MANAGER.SetUserName(self.test_username) # Make the user use the advanced gui so we can test it. data_store.REL_DB.WriteGRRUser( self.test_username, ui_mode=api_user.GUISettings.UIMode.ADVANCED) artifact_patcher = ar_test_lib.PatchDatastoreOnlyArtifactRegistry() artifact_patcher.start() self.addCleanup(artifact_patcher.stop) self.InstallACLChecks() if flags.FLAGS.use_headless_chrome: params = { "cmd": "Page.setDownloadBehavior", "params": { "behavior": "allow", "downloadPath": self.temp_dir } } result = self.driver.execute("send_command", params) if result["status"] != 0: raise RuntimeError("can't set Page.setDownloadBehavior: %s" % result)
def setUp(self): super(GRRSeleniumTest, self).setUp() # Used by InstallACLChecks/UninstallACLChecks self.config_override = None # Used by CheckHttpErrors self.ignore_http_errors = False self.token.username = u"gui_user" webauth.WEBAUTH_MANAGER.SetUserName(self.token.username) # Make the user use the advanced gui so we can test it. if data_store.RelationalDBReadEnabled(): data_store.REL_DB.WriteGRRUser( self.token.username, ui_mode=users.GUISettings.UIMode.ADVANCED) else: with aff4.FACTORY.Create(aff4.ROOT_URN.Add("users/%s" % self.token.username), aff4_type=users.GRRUser, mode="w", token=self.token) as user_fd: user_fd.Set(user_fd.Schema.GUI_SETTINGS(mode="ADVANCED")) self._artifact_patcher = ar_test_lib.PatchDatastoreOnlyArtifactRegistry( ) self._artifact_patcher.start() self.InstallACLChecks() if flags.FLAGS.use_headless_chrome: params = { "cmd": "Page.setDownloadBehavior", "params": { "behavior": "allow", "downloadPath": self.temp_dir } } result = self.driver.execute("send_command", params) if result["status"] != 0: raise RuntimeError("can't set Page.setDownloadBehavior: %s" % result)