How to use delete_mapping method in tempest

Best Python code snippet using tempest_python

stable_version_unittest.py

Source:stable_version_unittest.py Github

copy

Full Screen

...116 def test_set_mapping_no_type(self):117 """Test error when `set_mapping` is called without a type."""118 argv = ['command', 'board', 'V0.0']119 self._assert_command_error(argv)120 def test_delete_mapping(self):121 """Test that `delete_mapping` is called when required."""122 argv = ['command', '-t', frontend.AFE.CROS_IMAGE_TYPE, '-d', 'board']123 afe = object()124 called_mock = self._dispatch_command_success(125 afe, argv, 'delete_mapping')126 called_mock.assert_called_once_with(afe, argv[2], argv[4], False)127 def test_delete_mapping_no_key(self):128 """Test error when `delete_mapping` is called without a key."""129 argv = ['command', '-t', frontend.AFE.CROS_IMAGE_TYPE, '-d']130 self._assert_command_error(argv)131 def test_delete_mapping_no_type(self):132 """Test error when `delete_mapping` is called without a type."""133 argv = ['command', '-d', 'board']134 self._assert_command_error(argv)...

Full Screen

Full Screen

bibknowledge_webinterface.py

Source:bibknowledge_webinterface.py Github

copy

Full Screen

1## This file is part of Invenio.2## Copyright (C) 2009, 2010, 2011 CERN.3##4## Invenio is free software; you can redistribute it and/or5## modify it under the terms of the GNU General Public License as6## published by the Free Software Foundation; either version 2 of the7## License, or (at your option) any later version.8##9## Invenio is distributed in the hope that it will be useful, but10## WITHOUT ANY WARRANTY; without even the implied warranty of11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU12## General Public License for more details.13##14## You should have received a copy of the GNU General Public License15## along with Invenio; if not, write to the Free Software Foundation, Inc.,16## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.17"""BibKnowledge URL handler."""18__revision__ = "$Id$"19from invenio.webinterface_handler import wash_urlargd, WebInterfaceDirectory20from invenio import bibknowledgeadmin21from invenio.config import CFG_SITE_LANG22class WebInterfaceBibKnowledgePages(WebInterfaceDirectory):23 """ Handle /kb/ etc set of pages."""24 extrapath = ""25 def __init__(self, extrapath=""):26 """Constructor."""27 self.extrapath = extrapath28 def _lookup(self, component, path):29 """This handler parses dynamic URLs (/kb, /kb/export, /kb/upload etc)."""30 return WebInterfaceBibKnowledgePages(component), path31 def __call__(self, req, form):32 """Serve the page in the given language."""33 argd = wash_urlargd(form, {'ln': (str, CFG_SITE_LANG),34 'kb': (int, -1),35 'search': (str, ''), #what to search in the rules36 'descriptiontoo': (int, 0), #search descriptions, too37 'action': (str, ''), #delete/new/attributes/update_attributes/add_mapping/edit_mapping/dynamic_update38 'chosen_option': (str, ''), #for the 'really delete' dialog39 'sortby': (str, ''), #sort rules by key or value40 'startat': (int, 0), #sort rules by key or value41 'name': (str, ''), #name in new/rename operations42 'description': (str, ''), #description in new/rename operations43 'mapFrom': (str, ''), 'mapTo': (str, ''), #mappings44 'forcetype': (str, ''), #force mapping45 'replacements': (str, ''), #needed for overlapping mappings46 'save_mapping': (str, ''), #type of edit_mapping47 'delete_mapping': (str, ''), #type of edit_mapping48 'field': (str, ''), #for dynamic kbs49 'expression': (str, ''), #for dynamic kbs50 'collection': (str, ''), #for dynamic kbs51 'kbname': (str, ''), #for exporting52 'format': (str, ''), #for exporting53 'term': (str, ''), #for exporting to JQuery UI54 'kbtype': (str, '')})55 ln = argd['ln']56 kb = argd['kb']57 search = argd['search']58 descriptiontoo = argd['descriptiontoo']59 action = argd['action']60 chosen_option = argd['chosen_option']61 name = argd['name']62 description = argd['description']63 sortby = argd['sortby']64 startat = argd['startat']65 mapFrom = argd['mapFrom']66 mapTo = argd['mapTo']67 kbtype = argd['kbtype']68 field = argd['field']69 expression = argd['expression']70 collection = argd['collection']71 forcetype = argd['forcetype']72 replacements = argd['replacements']73 save_mapping = argd['save_mapping']74 delete_mapping = argd['delete_mapping']75 kbname = argd['kbname']76 format = argd['format']77 term = argd['term']78 req.argd = argd #needed by some lower level modules79 #check upload80 if self.extrapath == "upload":81 return bibknowledgeadmin.kb_upload(req, kb=kb, ln=ln)82 #check if this is "export"83 if self.extrapath == "export":84 return bibknowledgeadmin.kb_export(req, kbname=kbname, format=format, ln=ln, searchvalue=term)85 #first check if this is a specific action86 if action == "new":87 return bibknowledgeadmin.kb_add(req, kbtype=kbtype, sortby=sortby, ln=ln)88 if action == "attributes":89 return bibknowledgeadmin.kb_show_attributes(req, kb=kb, ln=ln)90 if action == "update_attributes":91 return bibknowledgeadmin.kb_update_attributes(req, kb=kb, name=name, description=description, ln=ln)92 if action == "delete":93 return bibknowledgeadmin.kb_delete(req, kb=kb, ln=ln, chosen_option=chosen_option)94 if action == "add_mapping":95 return bibknowledgeadmin.kb_add_mapping(req, kb=kb, ln=ln, mapFrom=mapFrom, mapTo=mapTo, forcetype=forcetype, replacements=replacements, kb_type=kbtype)96 if action == "edit_mapping":97 return bibknowledgeadmin.kb_edit_mapping(req, kb=kb, key=mapFrom, mapFrom=mapFrom, mapTo=mapTo, update=save_mapping, delete=delete_mapping, sortby=sortby, ln=ln)98 if action == "dynamic_update":99 return bibknowledgeadmin.kb_dynamic_update(req, kb_id=kb, ln=ln, field=field, expression=expression, collection=collection)100 #then, check if this is a "list all" or "show kb" request..101 if (kb > -1):102 return bibknowledgeadmin.kb_show(req, ln=ln, sortby=sortby, startat=startat, kb=kb, search=search)103 else:104 return bibknowledgeadmin.index(req, ln=ln, search=search, descriptiontoo=descriptiontoo)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful