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


Python ParseError.json_body方法代码示例

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


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

示例1: test_error

# 需要导入模块: from ichnaea.api.exceptions import ParseError [as 别名]
# 或者: from ichnaea.api.exceptions.ParseError import json_body [as 别名]
 def test_error(self, app, celery, raven):
     wifi = WifiShardFactory.build()
     res = app.post_json(
         '/v1/submit',
         [{'lat': wifi.lat, 'lon': wifi.lon, 'cell': []}],
         status=400)
     assert res.json == ParseError.json_body()
     raven.check(['ParseError'])
开发者ID:amjadm61,项目名称:ichnaea,代码行数:10,代码来源:test_submit_v0.py

示例2: test_error

# 需要导入模块: from ichnaea.api.exceptions import ParseError [as 别名]
# 或者: from ichnaea.api.exceptions.ParseError import json_body [as 别名]
 def test_error(self):
     wifi = WifiShardFactory.build()
     res = self.app.post_json(
         '/v1/submit',
         [{'lat': wifi.lat, 'lon': wifi.lon, 'cell': []}],
         status=400)
     self.assertEqual(res.json, ParseError.json_body())
     self.check_raven(['ParseError'])
开发者ID:cemoulto,项目名称:ichnaea,代码行数:10,代码来源:tests.py

示例3: check_response

# 需要导入模块: from ichnaea.api.exceptions import ParseError [as 别名]
# 或者: from ichnaea.api.exceptions.ParseError import json_body [as 别名]
 def check_response(self, response, status):
     self.assertEqual(response.content_type, 'application/json')
     self.assertEqual(response.charset, 'UTF-8')
     if status == 'ok':
         self.assertEqual(response.json, self.ip_response)
     elif status == 'invalid_key':
         self.assertEqual(response.json, InvalidAPIKey.json_body())
     elif status == 'not_found':
         self.assertEqual(response.json, self.not_found.json_body())
     elif status == 'parse_error':
         self.assertEqual(response.json, ParseError.json_body())
     elif status == 'limit_exceeded':
         self.assertEqual(response.json, DailyLimitExceeded.json_body())
开发者ID:therewillbecode,项目名称:ichnaea,代码行数:15,代码来源:base.py

示例4: check_response

# 需要导入模块: from ichnaea.api.exceptions import ParseError [as 别名]
# 或者: from ichnaea.api.exceptions.ParseError import json_body [as 别名]
 def check_response(self, response, status):
     self.assertEqual(response.content_type, "application/json")
     self.assertEqual(response.charset, "UTF-8")
     self.assertEqual(response.headers["Access-Control-Allow-Origin"], "*")
     self.assertEqual(response.headers["Access-Control-Max-Age"], "2592000")
     if status == "ok":
         self.assertEqual(response.json, self.ip_response)
     elif status == "invalid_key":
         self.assertEqual(response.json, InvalidAPIKey.json_body())
     elif status == "not_found":
         self.assertEqual(response.json, self.not_found.json_body())
     elif status == "parse_error":
         self.assertEqual(response.json, ParseError.json_body())
     elif status == "limit_exceeded":
         self.assertEqual(response.json, DailyLimitExceeded.json_body())
开发者ID:cemoulto,项目名称:ichnaea,代码行数:17,代码来源:base.py

示例5: check_response

# 需要导入模块: from ichnaea.api.exceptions import ParseError [as 别名]
# 或者: from ichnaea.api.exceptions.ParseError import json_body [as 别名]
 def check_response(self, data_queues, response, status):
     assert response.content_type == 'application/json'
     assert response.headers['Access-Control-Allow-Origin'] == '*'
     assert response.headers['Access-Control-Max-Age'] == '2592000'
     if status == 'ok':
         assert response.json == self.ip_response
     elif status == 'invalid_key':
         assert response.json == InvalidAPIKey.json_body()
     elif status == 'not_found':
         assert response.json == self.not_found.json_body()
     elif status == 'parse_error':
         assert response.json == ParseError.json_body()
     elif status == 'limit_exceeded':
         assert response.json == DailyLimitExceeded.json_body()
     if status != 'ok':
         self.check_queue(data_queues, 0)
开发者ID:amjadm61,项目名称:ichnaea,代码行数:18,代码来源:base.py

示例6: test_error_empty_json

# 需要导入模块: from ichnaea.api.exceptions import ParseError [as 别名]
# 或者: from ichnaea.api.exceptions.ParseError import json_body [as 别名]
 def test_error_empty_json(self):
     res = self.app.post_json(self.url, {}, status=400)
     self.assertEqual(res.json, ParseError.json_body())
开发者ID:SOFTowaha,项目名称:ichnaea,代码行数:5,代码来源:base.py

示例7: test_error_get

# 需要导入模块: from ichnaea.api.exceptions import ParseError [as 别名]
# 或者: from ichnaea.api.exceptions.ParseError import json_body [as 别名]
 def test_error_get(self):
     res = self.app.get(self.url, status=400)
     self.assertEqual(res.json, ParseError.json_body())
开发者ID:SOFTowaha,项目名称:ichnaea,代码行数:5,代码来源:base.py

示例8: test_error_empty_body

# 需要导入模块: from ichnaea.api.exceptions import ParseError [as 别名]
# 或者: from ichnaea.api.exceptions.ParseError import json_body [as 别名]
 def test_error_empty_body(self, app, raven):
     res = app.post(self.url, '', status=400)
     assert res.json == ParseError.json_body()
     raven.check([('ParseError', 1)])
开发者ID:amjadm61,项目名称:ichnaea,代码行数:6,代码来源:base.py

示例9: test_error_no_mapping

# 需要导入模块: from ichnaea.api.exceptions import ParseError [as 别名]
# 或者: from ichnaea.api.exceptions.ParseError import json_body [as 别名]
 def test_error_no_mapping(self, app):
     res = self._call(app, [1], method='post_json', status=400)
     assert res.json == ParseError.json_body()
开发者ID:jinsuki,项目名称:ichnaea,代码行数:5,代码来源:test_views.py

示例10: test_no_json

# 需要导入模块: from ichnaea.api.exceptions import ParseError [as 别名]
# 或者: from ichnaea.api.exceptions.ParseError import json_body [as 别名]
 def test_no_json(self):
     res = self.app.post('/v1/search?key=test', '\xae', status=400)
     self.assertEqual(res.json, ParseError.json_body())
     self.check_stats(counter=['search.api_key.test'])
开发者ID:JaredKerim-Mozilla,项目名称:ichnaea,代码行数:6,代码来源:tests.py

示例11: test_error_no_json

# 需要导入模块: from ichnaea.api.exceptions import ParseError [as 别名]
# 或者: from ichnaea.api.exceptions.ParseError import json_body [as 别名]
 def test_error_no_json(self):
     res = self.app.post(self.url, "\xae", status=400)
     self.assertEqual(res.json, ParseError.json_body())
     self.check_raven([("ParseError", 1)])
开发者ID:voolitels,项目名称:ichnaea,代码行数:6,代码来源:base.py

示例12: test_error_empty_body

# 需要导入模块: from ichnaea.api.exceptions import ParseError [as 别名]
# 或者: from ichnaea.api.exceptions.ParseError import json_body [as 别名]
 def test_error_empty_body(self):
     res = self.app.post(self.url, '', status=400)
     self.assertEqual(res.json, ParseError.json_body())
     self.check_raven([('ParseError', 1)])
开发者ID:ingle,项目名称:ichnaea,代码行数:6,代码来源:base.py

示例13: test_error_no_mapping

# 需要导入模块: from ichnaea.api.exceptions import ParseError [as 别名]
# 或者: from ichnaea.api.exceptions.ParseError import json_body [as 别名]
 def test_error_no_mapping(self):
     res = self.app.post_json('/v1/submit', [1], status=400)
     self.assertEqual(res.json, ParseError.json_body())
开发者ID:JaredKerim-Mozilla,项目名称:ichnaea,代码行数:5,代码来源:tests.py

示例14: test_error_completely_empty

# 需要导入模块: from ichnaea.api.exceptions import ParseError [as 别名]
# 或者: from ichnaea.api.exceptions.ParseError import json_body [as 别名]
 def test_error_completely_empty(self):
     res = self.app.post_json(self.url, [], status=400)
     self.assertEqual(res.content_type, 'application/json')
     self.assertEqual(res.json, ParseError.json_body())
开发者ID:JaredKerim-Mozilla,项目名称:ichnaea,代码行数:6,代码来源:tests.py

示例15: test_error_no_mapping

# 需要导入模块: from ichnaea.api.exceptions import ParseError [as 别名]
# 或者: from ichnaea.api.exceptions.ParseError import json_body [as 别名]
 def test_error_no_mapping(self, app, raven):
     res = app.post_json(self.url, [1], status=400)
     assert res.json == ParseError.json_body()
开发者ID:crankycoder,项目名称:ichnaea,代码行数:5,代码来源:base.py


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