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


Python httpretty.DELETE属性代码示例

本文整理汇总了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") 
开发者ID:rbw,项目名称:pysnow,代码行数:25,代码来源:test_resource.py

示例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") 
开发者ID:rbw,项目名称:pysnow,代码行数:25,代码来源:test_resource.py

示例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) 
开发者ID:rbw,项目名称:pysnow,代码行数:25,代码来源:test_attachment.py

示例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') 
开发者ID:polyaxon,项目名称:polyaxon-client,代码行数:22,代码来源:test_experiment.py

示例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') 
开发者ID:polyaxon,项目名称:polyaxon-client,代码行数:23,代码来源:test_experiment.py

示例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') 
开发者ID:polyaxon,项目名称:polyaxon-client,代码行数:22,代码来源:test_build_job.py

示例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') 
开发者ID:polyaxon,项目名称:polyaxon-client,代码行数:23,代码来源:test_build_job.py

示例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') 
开发者ID:polyaxon,项目名称:polyaxon-client,代码行数:20,代码来源:test_project.py

示例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') 
开发者ID:polyaxon,项目名称:polyaxon-client,代码行数:21,代码来源:test_project.py

示例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') 
开发者ID:polyaxon,项目名称:polyaxon-client,代码行数:22,代码来源:test_experiment_group.py

示例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') 
开发者ID:polyaxon,项目名称:polyaxon-client,代码行数:23,代码来源:test_experiment_group.py

示例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') 
开发者ID:polyaxon,项目名称:polyaxon-client,代码行数:22,代码来源:test_job.py

示例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') 
开发者ID:GetStream,项目名称:stream-django,代码行数:6,代码来源:test_model_integration.py

示例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) 
开发者ID:GetStream,项目名称:stream-django,代码行数:9,代码来源:test_model_integration.py

示例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) 
开发者ID:rbw,项目名称:pysnow,代码行数:34,代码来源:test_request.py


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