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


Python Controller.generate_request_headers方法代码示例

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


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

示例1: test_generate_request_headers

# 需要导入模块: from swift.proxy.controllers.base import Controller [as 别名]
# 或者: from swift.proxy.controllers.base.Controller import generate_request_headers [as 别名]
 def test_generate_request_headers(self):
     base = Controller(self.app)
     src_headers = {"x-remove-base-meta-owner": "x", "x-base-meta-size": "151M", "new-owner": "Kun"}
     req = Request.blank("/v1/a/c/o", headers=src_headers)
     dst_headers = base.generate_request_headers(req, transfer=True)
     expected_headers = {"x-base-meta-owner": "", "x-base-meta-size": "151M", "connection": "close"}
     for k, v in expected_headers.iteritems():
         self.assertTrue(k in dst_headers)
         self.assertEqual(v, dst_headers[k])
     self.assertFalse("new-owner" in dst_headers)
开发者ID:helen5haha,项目名称:swift,代码行数:12,代码来源:test_base.py

示例2: test_generate_request_headers_with_no_orig_req

# 需要导入模块: from swift.proxy.controllers.base import Controller [as 别名]
# 或者: from swift.proxy.controllers.base.Controller import generate_request_headers [as 别名]
 def test_generate_request_headers_with_no_orig_req(self):
     base = Controller(self.app)
     src_headers = {'x-remove-base-meta-owner': 'x',
                    'x-base-meta-size': '151M',
                    'new-owner': 'Kun'}
     dst_headers = base.generate_request_headers(None,
                                                 additional=src_headers)
     expected_headers = {'x-base-meta-size': '151M',
                         'connection': 'close'}
     for k, v in expected_headers.items():
         self.assertDictContainsSubset(expected_headers, dst_headers)
     self.assertEqual('', dst_headers['Referer'])
开发者ID:bkolli,项目名称:swift,代码行数:14,代码来源:test_base.py

示例3: test_generate_request_headers

# 需要导入模块: from swift.proxy.controllers.base import Controller [as 别名]
# 或者: from swift.proxy.controllers.base.Controller import generate_request_headers [as 别名]
 def test_generate_request_headers(self):
     base = Controller(self.app)
     src_headers = {'x-remove-base-meta-owner': 'x',
                    'x-base-meta-size': '151M',
                    'new-owner': 'Kun'}
     req = Request.blank('/v1/a/c/o', headers=src_headers)
     dst_headers = base.generate_request_headers(req, transfer=True)
     expected_headers = {'x-base-meta-owner': '',
                         'x-base-meta-size': '151M'}
     for k, v in expected_headers.iteritems():
         self.assertTrue(k in dst_headers)
         self.assertEqual(v, dst_headers[k])
     self.assertFalse('new-owner' in dst_headers)
开发者ID:10389030,项目名称:swift,代码行数:15,代码来源:test_base.py

示例4: test_generate_request_headers_with_sysmeta

# 需要导入模块: from swift.proxy.controllers.base import Controller [as 别名]
# 或者: from swift.proxy.controllers.base.Controller import generate_request_headers [as 别名]
 def test_generate_request_headers_with_sysmeta(self):
     base = Controller(self.app)
     good_hdrs = {"x-base-sysmeta-foo": "ok", "X-Base-sysmeta-Bar": "also ok"}
     bad_hdrs = {"x-base-sysmeta-": "too short"}
     hdrs = dict(good_hdrs)
     hdrs.update(bad_hdrs)
     req = Request.blank("/v1/a/c/o", headers=hdrs)
     dst_headers = base.generate_request_headers(req, transfer=True)
     for k, v in good_hdrs.iteritems():
         self.assertTrue(k.lower() in dst_headers)
         self.assertEqual(v, dst_headers[k.lower()])
     for k, v in bad_hdrs.iteritems():
         self.assertFalse(k.lower() in dst_headers)
开发者ID:helen5haha,项目名称:swift,代码行数:15,代码来源:test_base.py

示例5: test_generate_request_headers_with_sysmeta

# 需要导入模块: from swift.proxy.controllers.base import Controller [as 别名]
# 或者: from swift.proxy.controllers.base.Controller import generate_request_headers [as 别名]
 def test_generate_request_headers_with_sysmeta(self):
     base = Controller(self.app)
     good_hdrs = {'x-base-sysmeta-foo': 'ok',
                  'X-Base-sysmeta-Bar': 'also ok'}
     bad_hdrs = {'x-base-sysmeta-': 'too short'}
     hdrs = dict(good_hdrs)
     hdrs.update(bad_hdrs)
     req = Request.blank('/v1/a/c/o', headers=hdrs)
     dst_headers = base.generate_request_headers(req, transfer=True)
     for k, v in good_hdrs.items():
         self.assertIn(k.lower(), dst_headers)
         self.assertEqual(v, dst_headers[k.lower()])
     for k, v in bad_hdrs.items():
         self.assertNotIn(k.lower(), dst_headers)
开发者ID:mahak,项目名称:swift,代码行数:16,代码来源:test_base.py


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