当前位置: 首页>>代码示例>>Python>>正文


Python Processor.run方法代码示例

本文整理汇总了Python中seishub.core.processor.Processor.run方法的典型用法代码示例。如果您正苦于以下问题:Python Processor.run方法的具体用法?Python Processor.run怎么用?Python Processor.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在seishub.core.processor.Processor的用法示例。


在下文中一共展示了Processor.run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_processResourceType

# 需要导入模块: from seishub.core.processor import Processor [as 别名]
# 或者: from seishub.core.processor.Processor import run [as 别名]
 def test_processResourceType(self):
     proc = Processor(self.env)
     proc.path = '/xml/processor-test/notvc'
     # test valid GET method
     data = proc.run(GET, '/xml/processor-test/notvc')
     # data must be a dict
     self.assertTrue(isinstance(data, dict))
     # test valid POST method
     data = proc.run(POST, '/xml/processor-test/notvc', StringIO(XML_DOC))
     # check response; data should be empty; we look into request
     self.assertFalse(data)
     self.assertEqual(proc.code, http.CREATED)
     self.assertTrue(isinstance(proc.headers, dict))
     self.assertTrue('Location' in proc.headers)
     location = proc.headers.get('Location')
     self.assertTrue(location.startswith(self.env.getRestUrl() + proc.path))
     # strip REST url from location
     location = location[len(self.env.getRestUrl()):]
     # fetch resource and compare it with original
     data = proc.run(GET, location)
     self.assertTrue(data, XML_DOC)
     # delete uploaded resource
     data = proc.run(DELETE, location)
     # check response; data should be empty; we look into request
     self.assertFalse(data)
     self.assertEqual(proc.code, http.NO_CONTENT)
开发者ID:,项目名称:,代码行数:28,代码来源:

示例2: test_moveToNewResource

# 需要导入模块: from seishub.core.processor import Processor [as 别名]
# 或者: from seishub.core.processor.Processor import run [as 别名]
 def test_moveToNewResource(self):
     """
     Resource was moved successfully to the specified destination URI.
     """
     proc = Processor(self.env)
     # create resource
     proc.run(POST, '/move-test/notvc/test.xml', StringIO(XML_DOC))
     # move
     uri = self.env.getRestUrl() + '/move-test/notvc/new.xml'
     data = proc.run(MOVE, '/move-test/notvc/test.xml',
                     received_headers={'Destination': uri})
     # test if right response code
     self.assertFalse(data)
     self.assertEqual(proc.code, http.CREATED)
     # test if location header is set
     self.assertTrue(isinstance(proc.headers, dict))
     self.assertTrue('Location' in proc.headers)
     location = proc.headers.get('Location')
     self.assertEquals(location, uri)
     # get original resource
     try:
         proc.run(GET, '/move-test/notvc/test.xml').render_GET(proc)
         self.fail("Expected SeisHubError")
     except SeisHubError, e:
         self.assertEqual(e.code, http.NOT_FOUND)
开发者ID:,项目名称:,代码行数:27,代码来源:

示例3: test_checkRegisteredMappers

# 需要导入模块: from seishub.core.processor import Processor [as 别名]
# 或者: from seishub.core.processor.Processor import run [as 别名]
 def test_checkRegisteredMappers(self):
     """
     Fetch mapper resource at different levels.
     """
     proc = Processor(self.env)
     # root level
     data = proc.run(GET, '/')
     self.assertTrue('mapper-test' in data.keys())
     self.assertTrue('testmapping4' in data.keys())
     # virtual level
     proc = Processor(self.env)
     data = proc.run(GET, '/mapper-test')
     # registered mappers
     self.assertTrue('testmapping' in data.keys())
     self.assertTrue('testmapping2' in data.keys())
     self.assertTrue('testmapping3' in data.keys())
     # unregistered mapper
     self.assertFalse('testmapping5' in data.keys())
     # content
     proc = Processor(self.env)
     data = proc.run(GET, '/mapper-test/testmapping')
     self.assertEqual(data, 'muh')
     # HEAD equals GET
     data = proc.run(HEAD, '/testmapping4')
     self.assertEquals(data, 'MÜH')
开发者ID:barsch,项目名称:seishub.core,代码行数:27,代码来源:test_mapper.py

示例4: test_getRevision

# 需要导入模块: from seishub.core.processor import Processor [as 别名]
# 或者: from seishub.core.processor.Processor import run [as 别名]
 def test_getRevision(self):
     proc = Processor(self.env)
     # create resource
     proc.run(POST, '/get-test/vc/test.xml', StringIO(XML_DOC))
     proc.run(PUT, '/get-test/vc/test.xml', StringIO(XML_DOC))
     proc.run(PUT, '/get-test/vc/test.xml', StringIO(XML_DOC))
     # without trailing slash
     res1 = proc.run(GET, '/get-test/vc/test.xml/1')
     data1 = res1.render_GET(proc)
     # with trailing slash
     res2 = proc.run(GET, '/get-test/vc/test.xml/1/')
     data2 = res2.render_GET(proc)
     # res must be RESTResource objects
     self.assertTrue(isinstance(res1, RESTResource))
     self.assertTrue(isinstance(res2, RESTResource))
     # both results should equal
     self.assertTrue(data1 == data2)
     # check content
     self.assertEquals(data1, XML_DOC)
     # GET revision 2
     res3 = proc.run(GET, '/get-test/vc/test.xml/2')
     data3 = res3.render_GET(proc)
     self.assertEquals(data3, XML_DOC)
     res4 = proc.run(GET, '/get-test/vc/test.xml/2/')
     data4 = res4.render_GET(proc)
     self.assertEquals(data4, XML_DOC)
     # delete resource
     proc.run(DELETE, '/get-test/vc/test.xml')
开发者ID:,项目名称:,代码行数:30,代码来源:

示例5: test_getRevisionIndex

# 需要导入模块: from seishub.core.processor import Processor [as 别名]
# 或者: from seishub.core.processor.Processor import run [as 别名]
 def test_getRevisionIndex(self):
     """
     Tests revision index property.
     """
     proc = Processor(self.env)
     # create resource
     XML_DOC2 = XML_BASE_DOC % ("üöäß", "%d")
     proc.run(POST, '/property-test/vc/test.xml/', StringIO(XML_DOC2 % 12))
     proc.run(PUT, '/property-test/vc/test.xml/', StringIO(XML_DOC2 % 234))
     proc.run(PUT, '/property-test/vc/test.xml/', StringIO(XML_DOC2 % 3456))
     # get index XML of latest revision w/o trailing slash
     res = proc.run(GET, '/property-test/vc/test.xml/.index')
     data = res.render_GET(proc)
     self.assertTrue("<label4>" in data)
     self.assertTrue("<value>3456</value>" in data)
     # get index XML of revision 3 w/o trailing slash
     res = proc.run(GET, '/property-test/vc/test.xml/3/.index')
     data = res.render_GET(proc)
     self.assertTrue("<label4>" in data)
     self.assertTrue("<value>3456</value>" in data)
     # get index XML of latest revision w/ trailing slash
     res = proc.run(GET, '/property-test/vc/test.xml/.index/')
     data = res.render_GET(proc)
     self.assertTrue("<label4>" in data)
     self.assertTrue("<value>3456</value>" in data)
     # get index XML of revision 3 w/ trailing slash
     res = proc.run(GET, '/property-test/vc/test.xml/3/.index/')
     data = res.render_GET(proc)
     self.assertTrue("<label4>" in data)
     self.assertTrue("<value>3456</value>" in data)
     # remove resource
     proc.run(DELETE, '/property-test/vc/test.xml')
开发者ID:krischer,项目名称:seishub.core,代码行数:34,代码来源:test_rest_property.py

示例6: test_getDisabledResourceType

# 需要导入模块: from seishub.core.processor import Processor [as 别名]
# 或者: from seishub.core.processor.Processor import run [as 别名]
 def test_getDisabledResourceType(self):
     proc = Processor(self.env)
     # without trailing slash
     try:
         proc.run(DELETE, '/get-test/notvc2')
         self.fail("Expected SeisHubError")
     except SeisHubError, e:
         self.assertEqual(e.code, http.NOT_FOUND)
开发者ID:,项目名称:,代码行数:10,代码来源:

示例7: test_invalidMethods

# 需要导入模块: from seishub.core.processor import Processor [as 别名]
# 或者: from seishub.core.processor.Processor import run [as 别名]
 def test_invalidMethods(self):
     proc = Processor(self.env)
     for method in ["MUH", "XXX", "GETPUT"]:
         try:
             proc.run(method, "/")
             self.fail("Expected SeisHubError")
         except SeisHubError, e:
             self.assertEqual(e.code, http.NOT_ALLOWED)
开发者ID:krischer,项目名称:seishub.core,代码行数:10,代码来源:test_tree.py

示例8: test_someRESTResourceTypes

# 需要导入模块: from seishub.core.processor import Processor [as 别名]
# 或者: from seishub.core.processor.Processor import run [as 别名]
 def test_someRESTResourceTypes(self):
     proc = Processor(self.env)
     result = proc.run(GET, "/")
     self.assertTrue(isinstance(result.get("xml"), RESTFolder))
     result = proc.run(GET, "/xml")
     self.assertTrue(isinstance(result.get("seishub"), RESTPackageFolder))
     result = proc.run(GET, "/xml/seishub")
     self.assertTrue(isinstance(result.get("stylesheet"), RESTResourceTypeFolder))
开发者ID:krischer,项目名称:seishub.core,代码行数:10,代码来源:test_tree.py

示例9: test_notImplementedMethods

# 需要导入模块: from seishub.core.processor import Processor [as 别名]
# 或者: from seishub.core.processor.Processor import run [as 别名]
 def test_notImplementedMethods(self):
     """
     Not implemented methods should raise an error.
     """
     proc = Processor(self.env)
     try:
         proc.run('MUH', '/testmapping4')
         self.fail("Expected SeisHubError")
     except SeisHubError, e:
         self.assertEqual(e.code, http.NOT_ALLOWED)
开发者ID:barsch,项目名称:seishub.core,代码行数:12,代码来源:test_mapper.py

示例10: test_deleteResourceInNotExistingResourceType

# 需要导入模块: from seishub.core.processor import Processor [as 别名]
# 或者: from seishub.core.processor.Processor import run [as 别名]
 def test_deleteResourceInNotExistingResourceType(self):
     """
     Resource can't be deleted from not existing resource type.
     """
     proc = Processor(self.env)
     try:
         proc.run(DELETE, '/delete-test/notvc2/test.xml')
         self.fail("Expected SeisHubError")
     except SeisHubError, e:
         self.assertEqual(e.code, http.NOT_FOUND)
开发者ID:,项目名称:,代码行数:12,代码来源:

示例11: test_processResource

# 需要导入模块: from seishub.core.processor import Processor [as 别名]
# 或者: from seishub.core.processor.Processor import run [as 别名]
 def test_processResource(self):
     proc = Processor(self.env)
     # upload a resource via POST
     data = proc.run(POST, '/xml/processor-test/notvc', StringIO(XML_DOC))
     # check response; data should be empty; we look into request
     self.assertFalse(data)
     self.assertEqual(proc.code, http.CREATED)
     self.assertTrue(isinstance(proc.headers, dict))
     self.assertTrue('Location' in proc.headers)
     location = proc.headers.get('Location')
     self.assertTrue(location.startswith(self.env.getRestUrl() + proc.path))
     # GET resource
     location = location[len(self.env.getRestUrl()):]
     data = proc.run(GET, location).render_GET(proc)
     self.assertEquals(data, XML_DOC)
     # overwrite this resource via PUT request
     proc.run(PUT, location, StringIO(XML_DOC2))
     # GET resource
     data = proc.run(GET, location).render_GET(proc)
     self.assertNotEquals(data, XML_DOC)
     self.assertEquals(data, XML_DOC2)
     # DELETE resource
     proc.run(DELETE, location)
     # GET deleted revision
     try:
         proc.run(GET, location).render_GET(proc)
         self.fail("Expected SeisHubError")
     except SeisHubError, e:
         self.assertEqual(e.code, http.NOT_FOUND)
开发者ID:,项目名称:,代码行数:31,代码来源:

示例12: test_getMultiFormatedResource

# 需要导入模块: from seishub.core.processor import Processor [as 别名]
# 或者: from seishub.core.processor.Processor import run [as 别名]
 def test_getMultiFormatedResource(self):
     """
     Get resource in a certain format using multiple style sheets.
     """
     proc = Processor(self.env)
     # create resource
     proc.run(POST, '/transformation-test/rt/test.xml', StringIO(XML_DOC))
     # transform using a format chain
     proc.args = {'format': ['xml2html', 'html2txt']}
     res = proc.run(GET, '/transformation-test/rt/test.xml')
     data = res.render(proc)
     self.assertEquals(data, TXT_DOC)
     # missing formats
     proc.args = {'format': ['XXX', 'YYY', 'ZZZ']}
     res = proc.run(GET, '/transformation-test/rt/test.xml')
     data = res.render(proc)
     self.assertEquals(data, XML_DOC)
     # one valid format
     proc.args = {'format': ['XXX', 'xml2html', 'YYY']}
     res = proc.run(GET, '/transformation-test/rt/test.xml')
     data = res.render(proc)
     self.assertEquals(data, HTML_DOC)
     # transform using a format chain but last style sheet is missing
     proc.args = {'format': ['xml2html', 'html2txt', 'XXX']}
     res = proc.run(GET, '/transformation-test/rt/test.xml')
     data = res.render(proc)
     self.assertEquals(data, TXT_DOC)
     # transform using a format chain but one style sheet is missing
     proc.args = {'format': ['xml2html', 'XXX', 'html2txt']}
     res = proc.run(GET, '/transformation-test/rt/test.xml')
     data = res.render(proc)
     self.assertEquals(data, TXT_DOC)
     # delete resource
     proc.run(DELETE, '/transformation-test/rt/test.xml')
开发者ID:barsch,项目名称:seishub.core,代码行数:36,代码来源:test_rest_transformation.py

示例13: test_strangeRequestPatterns

# 需要导入模块: from seishub.core.processor import Processor [as 别名]
# 或者: from seishub.core.processor.Processor import run [as 别名]
 def test_strangeRequestPatterns(self):
     """
     Test strange request patterns.
     """
     proc = Processor(self.env)
     # root
     data = proc.run(GET, '///')
     self.assertTrue('xml' in data)
     data = proc.run(GET, '//./')
     self.assertTrue('xml' in data)
     # results in /xml
     data = proc.run(GET, '/xml//')
     self.assertTrue('seishub' in data)
     data = proc.run(GET, '//xml/')
     self.assertTrue('seishub' in data)
     data = proc.run(GET, '//////////////////////xml//////////////')
     self.assertTrue('seishub' in data)
     data = proc.run(GET, '/////////./////////////xml///////.////.///')
     self.assertTrue('seishub' in data)
     # results in /xml/seishub
     data = proc.run(GET, '//////////////////////xml/////////////seishub/')
     self.assertTrue('schema' in data)
     data = proc.run(GET, '/////////////////xml///////.//////seishub////')
     self.assertTrue('schema' in data)
     data = proc.run(GET, '/////////////////xml/../xml////seishub////')
     self.assertTrue('schema' in data)
开发者ID:,项目名称:,代码行数:28,代码来源:

示例14: test_deleteVersionControlledResource

# 需要导入模块: from seishub.core.processor import Processor [as 别名]
# 或者: from seishub.core.processor.Processor import run [as 别名]
 def test_deleteVersionControlledResource(self):
     """
     Successful deletion of version controlled resources.
     """
     proc = Processor(self.env)
     # create resource
     proc.run(POST, '/delete-test/vc/test.xml', StringIO(XML_DOC))
     proc.run(PUT, '/delete-test/vc/test.xml', StringIO(XML_VCDOC % 1))
     proc.run(PUT, '/delete-test/vc/test.xml', StringIO(XML_VCDOC % 2))
     # check latest resource - should be #20
     data = proc.run(GET, '/delete-test/vc/test.xml').render_GET(proc)
     self.assertEqual(data, XML_VCDOC % 2)
     # check oldest resource -> revision start with 1
     data = proc.run(GET, '/delete-test/vc/test.xml/1').render_GET(proc)
     self.assertEqual(data, XML_DOC)
     # delete resource
     data = proc.run(DELETE, '/delete-test/vc/test.xml')
     self.assertEqual(data, '')
     self.assertEqual(proc.code, http.NO_CONTENT)
     # fetch resource again
     try:
         proc.run(GET, '/delete-test/vc/test.xml').render_GET(proc)
         self.fail("Expected SeisHubError")
     except SeisHubError, e:
         self.assertEqual(e.code, http.NOT_FOUND)
开发者ID:,项目名称:,代码行数:27,代码来源:

示例15: test_deleteNotExistingPackage

# 需要导入模块: from seishub.core.processor import Processor [as 别名]
# 或者: from seishub.core.processor.Processor import run [as 别名]
 def test_deleteNotExistingPackage(self):
     """
     A not existing resource package can't be deleted.
     """
     proc = Processor(self.env)
     # without trailing slash
     try:
         proc.run(DELETE, '/xxx')
         self.fail("Expected SeisHubError")
     except SeisHubError, e:
         self.assertEqual(e.code, http.NOT_FOUND)
开发者ID:,项目名称:,代码行数:13,代码来源:


注:本文中的seishub.core.processor.Processor.run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。