本文整理汇总了Python中httpretty.DELETE属性的典型用法代码示例。如果您正苦于以下问题:Python httpretty.DELETE属性的具体用法?Python httpretty.DELETE怎么用?Python httpretty.DELETE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类httpretty
的用法示例。
在下文中一共展示了httpretty.DELETE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_delete
# 需要导入模块: import httpretty [as 别名]
# 或者: from httpretty import DELETE [as 别名]
def test_delete(self):
""":meth:`delete` should return a dictionary containing status"""
httpretty.register_uri(
httpretty.GET,
self.mock_url_builder_base,
body=get_serialized_result(self.record_response_get_one),
status=200,
content_type="application/json",
)
httpretty.register_uri(
httpretty.DELETE,
self.mock_url_builder_sys_id,
body=get_serialized_result(self.record_response_delete),
status=204,
content_type="application/json",
)
result = self.resource.delete(self.dict_query)
self.assertEquals(type(result), dict)
self.assertEquals(result["status"], "record deleted")
示例2: test_delete_chained
# 需要导入模块: import httpretty [as 别名]
# 或者: from httpretty import DELETE [as 别名]
def test_delete_chained(self):
""":meth:`Response.delete` should return a dictionary containing status"""
httpretty.register_uri(
httpretty.GET,
self.mock_url_builder_base,
body=get_serialized_result(self.record_response_get_one),
status=200,
content_type="application/json",
)
httpretty.register_uri(
httpretty.DELETE,
self.mock_url_builder_sys_id,
body=get_serialized_result(self.record_response_delete),
status=204,
content_type="application/json",
)
result = self.resource.get(query={}).delete()
self.assertEquals(type(result), dict)
self.assertEquals(result["status"], "record deleted")
示例3: test_upload_delete
# 需要导入模块: import httpretty [as 别名]
# 或者: from httpretty import DELETE [as 别名]
def test_upload_delete(self):
"""Deleting an attachment should trigger pysnow to perform a lookup followed by a delete"""
httpretty.register_uri(
httpretty.GET,
self.attachment_base_url,
body=get_serialized_result(attachment),
status=200,
content_type="application/json",
)
httpretty.register_uri(
httpretty.DELETE,
self.attachment_url_sys_id,
body=get_serialized_result(delete_status),
status=204,
content_type="application/json",
)
resource = self.client.resource(api_path=mock_api_path)
result = resource.attachments.delete(mock_sys_id)
self.assertEqual(result, delete_status)
示例4: test_delete_experiment
# 需要导入模块: import httpretty [as 别名]
# 或者: from httpretty import DELETE [as 别名]
def test_delete_experiment(self):
httpretty.register_uri(
httpretty.DELETE,
BaseApiHandler.build_url(
self.api_config.base_url,
'/',
'username',
'project_name',
'experiments',
1),
content_type='application/json',
status=204)
result = self.api_handler.delete_experiment('username', 'project_name', 1)
assert result.status_code == 204
# Async
self.assert_async_call(
api_handler_call=lambda: self.api_handler.delete_experiment(
'username', 'project_name', 1, background=True),
method='delete')
示例5: test_unbookmark_experiment
# 需要导入模块: import httpretty [as 别名]
# 或者: from httpretty import DELETE [as 别名]
def test_unbookmark_experiment(self):
httpretty.register_uri(
httpretty.DELETE,
BaseApiHandler.build_url(
self.api_config.base_url,
'/',
'username',
'project_name',
'experiments',
1,
'unbookmark'),
content_type='application/json',
status=200)
result = self.api_handler.unbookmark('username', 'project_name', 1)
assert result.status_code == 200
# Async
self.assert_async_call(
api_handler_call=lambda: self.api_handler.unbookmark(
'username', 'project_name', 1, background=True),
method='delete')
示例6: test_delete_build
# 需要导入模块: import httpretty [as 别名]
# 或者: from httpretty import DELETE [as 别名]
def test_delete_build(self):
httpretty.register_uri(
httpretty.DELETE,
BaseApiHandler.build_url(
self.api_config.base_url,
'/',
'username',
'project_name',
'builds',
1),
content_type='application/json',
status=204)
result = self.api_handler.delete_build('username', 'project_name', 1)
assert result.status_code == 204
# Async
self.assert_async_call(
api_handler_call=lambda: self.api_handler.delete_build(
'username', 'project_name', 1, background=True),
method='delete')
示例7: test_unbookmark_build
# 需要导入模块: import httpretty [as 别名]
# 或者: from httpretty import DELETE [as 别名]
def test_unbookmark_build(self):
httpretty.register_uri(
httpretty.DELETE,
BaseApiHandler.build_url(
self.api_config.base_url,
'/',
'username',
'project_name',
'builds',
1,
'unbookmark'),
content_type='application/json',
status=200)
result = self.api_handler.unbookmark('username', 'project_name', 1)
assert result.status_code == 200
# Async
self.assert_async_call(
api_handler_call=lambda: self.api_handler.unbookmark(
'username', 'project_name', 1, background=True),
method='delete')
示例8: test_delete_project
# 需要导入模块: import httpretty [as 别名]
# 或者: from httpretty import DELETE [as 别名]
def test_delete_project(self):
httpretty.register_uri(
httpretty.DELETE,
BaseApiHandler.build_url(
self.api_config.base_url,
'/',
'user',
'project'),
content_type='application/json',
status=204)
result = self.api_handler.delete_project('user', 'project')
assert result.status_code == 204
# Async
self.assert_async_call(
api_handler_call=lambda: self.api_handler.delete_project(
'user', 'project', background=True),
method='delete')
示例9: test_unbookmark_project
# 需要导入模块: import httpretty [as 别名]
# 或者: from httpretty import DELETE [as 别名]
def test_unbookmark_project(self):
httpretty.register_uri(
httpretty.DELETE,
BaseApiHandler.build_url(
self.api_config.base_url,
'/',
'username',
'project_name',
'unbookmark'),
content_type='application/json',
status=200)
result = self.api_handler.unbookmark('username', 'project_name')
assert result.status_code == 200
# Async
self.assert_async_call(
api_handler_call=lambda: self.api_handler.unbookmark(
'user', 'project_name', background=True),
method='delete')
示例10: test_delete_experiment_group
# 需要导入模块: import httpretty [as 别名]
# 或者: from httpretty import DELETE [as 别名]
def test_delete_experiment_group(self):
httpretty.register_uri(
httpretty.DELETE,
BaseApiHandler.build_url(
self.api_config.base_url,
'/',
'username',
'project_name',
'groups',
1),
content_type='application/json',
status=204)
result = self.api_handler.delete_experiment_group('username', 'project_name', 1)
assert result.status_code == 204
# Async
self.assert_async_call(
api_handler_call=lambda: self.api_handler.delete_experiment_group(
'username', 'project_name', 1, background=True),
method='delete')
示例11: test_unbookmark_experiment_group
# 需要导入模块: import httpretty [as 别名]
# 或者: from httpretty import DELETE [as 别名]
def test_unbookmark_experiment_group(self):
httpretty.register_uri(
httpretty.DELETE,
BaseApiHandler.build_url(
self.api_config.base_url,
'/',
'username',
'project_name',
'groups',
1,
'unbookmark'),
content_type='application/json',
status=200)
result = self.api_handler.unbookmark('username', 'project_name', 1)
assert result.status_code == 200
# Async
self.assert_async_call(
api_handler_call=lambda: self.api_handler.unbookmark(
'username', 'project_name', 1, background=True),
method='delete')
示例12: test_delete_job
# 需要导入模块: import httpretty [as 别名]
# 或者: from httpretty import DELETE [as 别名]
def test_delete_job(self):
httpretty.register_uri(
httpretty.DELETE,
BaseApiHandler.build_url(
self.api_config.base_url,
'/',
'username',
'project_name',
'jobs',
1),
content_type='application/json',
status=204)
result = self.api_handler.delete_job('username', 'project_name', 1)
assert result.status_code == 204
# Async
self.assert_async_call(
api_handler_call=lambda: self.api_handler.delete_job(
'username', 'project_name', 1, background=True),
method='delete')
示例13: register_delete_api
# 需要导入模块: import httpretty [as 别名]
# 或者: from httpretty import DELETE [as 别名]
def register_delete_api(self):
httpretty.register_uri(httpretty.DELETE, api_url,
body='{}', status=200,
content_type='application/json')
示例14: test_delete
# 需要导入模块: import httpretty [as 别名]
# 或者: from httpretty import DELETE [as 别名]
def test_delete(self):
self.register_post_api()
self.register_delete_api()
pin = models.Pin.objects.create(author=self.bogus)
pin.delete()
last_req = httpretty.last_request()
self.assertEqual(last_req.method, httpretty.DELETE)
示例15: test_delete_incident
# 需要导入模块: import httpretty [as 别名]
# 或者: from httpretty import DELETE [as 别名]
def test_delete_incident(self):
"""
Delete an incident, make sure we get a 204 back along with expected body
"""
httpretty.register_uri(
httpretty.GET,
"http://%s/%s" % (self.mock_connection["host"], self.mock_incident["path"]),
body=json.dumps({"result": [{"sys_id": self.mock_incident["sys_id"]}]}),
status=200,
content_type="application/json",
)
httpretty.register_uri(
httpretty.DELETE,
"http://%s/%s/%s"
% (
self.mock_connection["host"],
self.mock_incident["path"],
self.mock_incident["sys_id"],
),
body=json.dumps({"success": True}),
status=204,
content_type="application/json",
)
r = self.client.query(
table="incident", query={"number": self.mock_incident["number"]}
)
result = r.delete()
self.assertEqual(result["success"], True)
self.assertEqual(r.status_code, 204)