本文整理汇总了Python中b2handle.handleclient.EUDATHandleClient.create_revlookup_query方法的典型用法代码示例。如果您正苦于以下问题:Python EUDATHandleClient.create_revlookup_query方法的具体用法?Python EUDATHandleClient.create_revlookup_query怎么用?Python EUDATHandleClient.create_revlookup_query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类b2handle.handleclient.EUDATHandleClient
的用法示例。
在下文中一共展示了EUDATHandleClient.create_revlookup_query方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: EUDATHandleClientSearchNoAccessTestCase
# 需要导入模块: from b2handle.handleclient import EUDATHandleClient [as 别名]
# 或者: from b2handle.handleclient.EUDATHandleClient import create_revlookup_query [as 别名]
class EUDATHandleClientSearchNoAccessTestCase(unittest.TestCase):
def __init__(self, *args, **kwargs):
unittest.TestCase.__init__(self, *args, **kwargs)
def setUp(self):
self.inst = EUDATHandleClient()
def tearDown(self):
pass
def test_search_handle_for_forbiddenkeys(self):
with self.assertRaisesRegexp(ReverseLookupException, 'Cannot search for key[.]*'):
self.inst.search_handle(url='*dkrz*',
checksum='*123*',
anotherfield='xyz')
def test_search_handle_for_fulltext(self):
with self.assertRaisesRegexp(ReverseLookupException, 'Full-text search is not implemented yet[.]*'):
self.inst.search_handle(url='*dkrz*',
checksum='*123*',
searchterms=['searchterm1', 'searchterm2'])
def test_search_handle_noterms(self):
with self.assertRaisesRegexp(ReverseLookupException, 'No search terms have been specified[.]*'):
self.inst.search_handle()
def test_create_revlookup_query_fulltext(self):
with self.assertRaisesRegexp(ReverseLookupException, 'Full-text search is not implemented yet[.]*'):
self.inst.create_revlookup_query('foo', 'bar')
def test_create_revlookup_query_forbiddenkeys(self):
with self.assertRaisesRegexp(ReverseLookupException, 'Cannot search for key[.]*'):
self.inst.create_revlookup_query(foo='foo', bar='bar')
def test_create_revlookup_query_noterms(self):
with self.assertRaisesRegexp(ReverseLookupException, 'No search terms have been specified[.]*'):
self.inst.create_revlookup_query()
def test_create_revlookup_query_norestriction(self):
inst = EUDATHandleClient(allowed_search_keys=[])
query = inst.create_revlookup_query(baz='baz')
self.assertEqual(query, '?baz=baz',
'The query is: '+query)
def test_create_revlookup_query_normal(self):
query = self.inst.create_revlookup_query(URL='foo')
self.assertEqual(query, '?URL=foo',
'The query is: '+query)
def test_instantiate_wrong_search_url(self):
inst = EUDATHandleClient.instantiate_for_read_and_search(
'someurl',
'someuser',
'somepassword',
reverselookup_baseuri='http://something_random_foo_bar')
self.assertIsInstance(inst, EUDATHandleClient)
示例2: EUDATHandleClientSearchNoAccessTestCase
# 需要导入模块: from b2handle.handleclient import EUDATHandleClient [as 别名]
# 或者: from b2handle.handleclient.EUDATHandleClient import create_revlookup_query [as 别名]
class EUDATHandleClientSearchNoAccessTestCase(unittest.TestCase):
def __init__(self, *args, **kwargs):
unittest.TestCase.__init__(self, *args, **kwargs)
def setUp(self):
self.inst = EUDATHandleClient()
def tearDown(self):
pass
def test_search_handle_for_forbiddenkeys(self):
with self.assertRaisesRegexp(ReverseLookupException, "Cannot search for key[.]*"):
self.inst.search_handle(url="*dkrz*", checksum="*123*", anotherfield="xyz")
def test_search_handle_for_fulltext(self):
with self.assertRaisesRegexp(ReverseLookupException, "Full-text search is not implemented yet[.]*"):
self.inst.search_handle(url="*dkrz*", checksum="*123*", searchterms=["searchterm1", "searchterm2"])
def test_search_handle_noterms(self):
with self.assertRaisesRegexp(ReverseLookupException, "No search terms have been specified[.]*"):
self.inst.search_handle()
def test_create_revlookup_query_fulltext(self):
with self.assertRaisesRegexp(ReverseLookupException, "Full-text search is not implemented yet[.]*"):
self.inst.create_revlookup_query("foo", "bar")
def test_create_revlookup_query_forbiddenkeys(self):
with self.assertRaisesRegexp(ReverseLookupException, "Cannot search for key[.]*"):
self.inst.create_revlookup_query(foo="foo", bar="bar")
def test_create_revlookup_query_noterms(self):
with self.assertRaisesRegexp(ReverseLookupException, "No search terms have been specified[.]*"):
self.inst.create_revlookup_query()
def test_create_revlookup_query_norestriction(self):
inst = EUDATHandleClient(allowed_search_keys=[])
query = inst.create_revlookup_query(baz="baz")
self.assertEqual(query, "?baz=baz", "The query is: " + query)
def test_create_revlookup_query_normal(self):
query = self.inst.create_revlookup_query(URL="foo")
self.assertEqual(query, "?URL=foo", "The query is: " + query)
def test_instantiate_wrong_search_url(self):
inst = EUDATHandleClient.instantiate_for_read_and_search(
"someurl", "someuser", "somepassword", reverselookup_baseuri="http://something_random_foo_bar"
)
self.assertIsInstance(inst, EUDATHandleClient)
示例3: test_create_revlookup_query_norestriction
# 需要导入模块: from b2handle.handleclient import EUDATHandleClient [as 别名]
# 或者: from b2handle.handleclient.EUDATHandleClient import create_revlookup_query [as 别名]
def test_create_revlookup_query_norestriction(self):
inst = EUDATHandleClient(allowed_search_keys=[])
query = inst.create_revlookup_query(baz='baz')
self.assertEqual(query, '?baz=baz',
'The query is: '+query)