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


Python EnvironBuilder.form['foo']方法代码示例

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


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

示例1: test_environ_builder_content_type

# 需要导入模块: from werkzeug.test import EnvironBuilder [as 别名]
# 或者: from werkzeug.test.EnvironBuilder import form['foo'] [as 别名]
 def test_environ_builder_content_type(self):
     builder = EnvironBuilder()
     assert builder.content_type is None
     builder.method = 'POST'
     assert builder.content_type == 'application/x-www-form-urlencoded'
     builder.form['foo'] = 'bar'
     assert builder.content_type == 'application/x-www-form-urlencoded'
     builder.files.add_file('blafasel', StringIO('foo'), 'test.txt')
     assert builder.content_type == 'multipart/form-data'
     req = builder.get_request()
     assert req.form['foo'] == 'bar'
     assert req.files['blafasel'].read() == 'foo'
开发者ID:0xJCG,项目名称:dubtrack-technical-test,代码行数:14,代码来源:test.py

示例2: test_environ_builder_content_type

# 需要导入模块: from werkzeug.test import EnvironBuilder [as 别名]
# 或者: from werkzeug.test.EnvironBuilder import form['foo'] [as 别名]
 def test_environ_builder_content_type(self):
     builder = EnvironBuilder()
     self.assert_is_none(builder.content_type)
     builder.method = 'POST'
     self.assert_equal(builder.content_type, 'application/x-www-form-urlencoded')
     builder.form['foo'] = 'bar'
     self.assert_equal(builder.content_type, 'application/x-www-form-urlencoded')
     builder.files.add_file('blafasel', BytesIO(b'foo'), 'test.txt')
     self.assert_equal(builder.content_type, 'multipart/form-data')
     req = builder.get_request()
     self.assert_strict_equal(req.form['foo'], u'bar')
     self.assert_strict_equal(req.files['blafasel'].read(), b'foo')
开发者ID:poffdeluxe,项目名称:werkzeug,代码行数:14,代码来源:test.py

示例3: test_environ_builder_content_type

# 需要导入模块: from werkzeug.test import EnvironBuilder [as 别名]
# 或者: from werkzeug.test.EnvironBuilder import form['foo'] [as 别名]
def test_environ_builder_content_type():
    builder = EnvironBuilder()
    assert builder.content_type is None
    builder.method = 'POST'
    assert builder.content_type is None
    builder.method = 'PUT'
    assert builder.content_type is None
    builder.method = 'PATCH'
    assert builder.content_type is None
    builder.method = 'DELETE'
    assert builder.content_type is None
    builder.method = 'GET'
    assert builder.content_type == None
    builder.form['foo'] = 'bar'
    assert builder.content_type == 'application/x-www-form-urlencoded'
    builder.files.add_file('blafasel', BytesIO(b'foo'), 'test.txt')
    assert builder.content_type == 'multipart/form-data'
    req = builder.get_request()
    strict_eq(req.form['foo'], u'bar')
    strict_eq(req.files['blafasel'].read(), b'foo')
开发者ID:ArielAzia,项目名称:werkzeug,代码行数:22,代码来源:test_test.py


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