• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python http.get函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中marconi.tests.system.common.http.get函数的典型用法代码示例。如果您正苦于以下问题:Python get函数的具体用法?Python get怎么用?Python get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_005_message_get_echo_false

    def test_005_message_get_echo_false(self):
        """Get Messages with echo=false."""
        url = self.cfg.base_url + \
            '/queues/messagetestqueue/messages?echo=false'
        result = http.get(url, self.header)

        self.assertEqual(result.status_code, 204)
开发者ID:BryanSD,项目名称:marconi,代码行数:7,代码来源:test_messages.py


示例2: test_007_claim_expired

    def test_007_claim_expired(self):
        """Update, Get and Release Expired Claim."""
        #Test Setup - Post Claim.
        url = self.cfg.base_url + '/queues/claimtestqueue/claims'
        doc = '{"ttl": 1, "grace": 0}'

        result = http.post(url, self.header, doc)
        self.assertEqual(result.status_code, 201)

        time.sleep(2)

        #Extract claim location and construct the claim URL.
        location = result.headers['Location']
        url = self.cfg.base_server + location

        #Update Expired Claim.
        doc = '{"ttl": 300}'
        result = http.patch(url, self.header, doc)
        self.assertEqual(result.status_code, 404)

        #Get Expired Claim.
        result = http.get(url, self.header)
        self.assertEqual(result.status_code, 404)

        #Release Expired Claim.
        result = http.delete(url, self.header)
        self.assertEqual(result.status_code, 204)
开发者ID:ozgurakan,项目名称:marconi,代码行数:27,代码来源:test_claims.py


示例3: verify_post_msg

def verify_post_msg(msg_headers, posted_body):
    """Verifies the response of POST Message(s).

    Retrieves the posted Message(s) & validates the message metadata.
    :param msg_headers: headers returned for post message request.
    :param posted_body: message metadata(s) in the post message request.
    """
    test_result_flag = False

    location = msg_headers['location']
    url = functionlib.create_url_from_appender(location)
    header = functionlib.create_marconi_headers()

    getmsg = http.get(url, header)
    if getmsg.status_code == 200:
        test_result_flag = True
    else:
        print('Failed to GET {}'.format(url))
        print('Request Header')
        print(header)
        print('Response Headers')
        print(getmsg.headers)
        print('Response Body')
        print(getmsg.text)
    return test_result_flag
开发者ID:alextricity25,项目名称:marconi,代码行数:25,代码来源:msgfnlib.py


示例4: test_002_message_bulk_insert

    def test_002_message_bulk_insert(self):
        """Bulk Insert Messages into the Queue."""
        message_count = 30
        doc = msgfnlib.get_message_body(messagecount=message_count)
        url = self.cfg.base_url + '/queues/messagetestqueue/messages'
        result = http.post(url, self.header, doc)

        self.assertEqual(result.status_code, 201)

        #GET on posted messages
        location = result.headers['location']
        url = self.cfg.base_server + location
        result = http.get(url, self.header)
        self.assertEqual(result.status_code, 200)

        #Compare message metadata
        result_body = [result.json()['messages'][i]['body']
                       for i in range(len(result.json()['messages']))]
        result_body.sort()

        posted_metadata = [doc[i]['body']
                           for i in range(message_count)]
        posted_metadata.sort()

        self.assertEqual(result_body, posted_metadata)
开发者ID:BryanSD,项目名称:marconi,代码行数:25,代码来源:test_messages.py


示例5: test_001_message_single_insert

    def test_001_message_single_insert(self):
        """Insert Single Message into the Queue.

        This test also verifies that claimed messages are
        retuned (or not) depending on the include_claimed flag.
        """
        doc = msgfnlib.get_message_body(messagecount=1)
        url = self.cfg.base_url + '/queues/messagetestqueue/messages'

        result = http.post(url, self.header, doc)
        self.assertEqual(result.status_code, 201)

        response_headers = set(result.headers.keys())
        self.assertIsSubset(self.headers_response_with_body, response_headers)

        #GET on posted message
        href = result.json()['resources'][0]
        url = self.cfg.base_server + href

        result = http.get(url, self.header)
        self.assertEqual(result.status_code, 200)

        #Compare message metadata
        result_body = result.json()['body']
        posted_metadata = doc[0]['body']
        self.assertEqual(result_body, posted_metadata)

        #Post a claim & verify the include_claimed flag.
        url = self.cfg.base_url + '/queues/messagetestqueue/claims'
        doc = '{"ttl": 300, "grace": 100}'
        result = http.post(url, self.header, doc)
        self.assertEqual(result.status_code, 200)

        url = self.cfg.base_url + '/queues/messagetestqueue/messages' \
                                  '?include_claimed=true'
        result = http.get(url, self.header)
        self.assertEqual(result.status_code, 200)

        response_message_body = result.json()["messages"][0]["body"]
        self.assertEqual(response_message_body, posted_metadata)

        #By default, include_claimed = false
        url = self.cfg.base_url + '/queues/messagetestqueue/messages'
        result = http.get(url, self.header)
        self.assertEqual(result.status_code, 204)
开发者ID:ozgurakan,项目名称:marconi,代码行数:45,代码来源:test_messages.py


示例6: test_025_check_queue_exists

    def test_025_check_queue_exists(self):
        """Checks non-existing queue."""
        url = self.cfg.base_url + '/queues/nonexistingqueue'

        result = http.get(url, self.header)
        self.assertEqual(result.status_code, 404)

        result = http.head(url, self.header)
        self.assertEqual(result.status_code, 404)
开发者ID:ozgurakan,项目名称:marconi,代码行数:9,代码来源:test_queue.py


示例7: test_012_queue_insert_nonASCII_metadata

    def test_012_queue_insert_nonASCII_metadata(self):
        """Insert Queue with non ASCII name."""
        url = self.cfg.base_url + '/queues/nonASCIImetadata'
        doc = '{"汉字": "non ASCII metadata"}'

        result = http.put(url, self.header, doc)
        self.assertEqual(result.status_code, 400)

        result = http.get(url, self.header)
        self.assertEqual(result.status_code, 404)
开发者ID:alextricity25,项目名称:marconi,代码行数:10,代码来源:test_queue.py


示例8: test_011_queue_insert_nonASCII_name

    def test_011_queue_insert_nonASCII_name(self):
        """Insert Queue with non ASCII name."""
        url = self.cfg.base_url + '/queues/汉字/漢字'
        doc = '{"queue": "non ASCII name"}'

        result = http.put(url, self.header, doc)
        self.assertEqual(result.status_code, 400)

        result = http.get(url, self.header)
        self.assertEqual(result.status_code, 404)
开发者ID:alextricity25,项目名称:marconi,代码行数:10,代码来源:test_queue.py


示例9: test_020_queue_stats

    def test_020_queue_stats(self):
        """Insert queue with name > 64 bytes."""
        url = self.cfg.base_url + '/queues/qtestqueue/stats'
        result = http.get(url, self.header)

        self.assertEqual(result.status_code, 200)

        test_result_flag = queuefnlib.verify_queue_stats(result.headers,
                                                         result.text)
        self.assertEqual(test_result_flag, True)
开发者ID:ozgurakan,项目名称:marconi,代码行数:10,代码来源:test_queue.py


示例10: test_022_queue_list_detailed

    def test_022_queue_list_detailed(self):
        """List Queues with detailed = True."""
        url = self.cfg.base_url + '/queues?detailed=True'
        result = http.get(url, self.header)

        self.assertEqual(result.status_code, 200)

        test_result_flag = queuefnlib.verify_list_queues(result.headers,
                                                         result.text)
        self.assertEqual(test_result_flag, True)
开发者ID:ozgurakan,项目名称:marconi,代码行数:10,代码来源:test_queue.py


示例11: test_008_queue_insert_toplevel_underscore

    def test_008_queue_insert_toplevel_underscore(self):
        """Insert Queue with underscore in toplevel field."""
        url = self.cfg.base_url + '/queues/toplevel'
        doc = '{"_queue": "Top Level field with _"}'

        result = http.put(url, self.header, doc)
        self.assertEqual(result.status_code, 400)

        result = http.get(url, self.header)
        self.assertEqual(result.status_code, 404)
开发者ID:alextricity25,项目名称:marconi,代码行数:10,代码来源:test_queue.py


示例12: test_024_check_queue_exists

    def test_024_check_queue_exists(self):
        """Checks if queue exists."""
        url = self.cfg.base_url + '/queues/qtestqueue'
        http.put(url, self.header)

        result = http.get(url, self.header)
        self.assertEqual(result.status_code, 204)

        result = http.head(url, self.header)
        self.assertEqual(result.status_code, 204)
开发者ID:ozgurakan,项目名称:marconi,代码行数:10,代码来源:test_queue.py


示例13: test_004_queue_update_empty_json

    def test_004_queue_update_empty_json(self):
        """Update Queue with empty json."""
        url = self.cfg.base_url + '/queues/qtestqueue'
        doc = '{}'

        result = http.put(url, self.header, doc)
        self.assertEqual(result.status_code, 204)

        result = http.get(url, self.header)
        self.assertEqual(result.status_code, 200)
        self.assertEqual(result.json(), json.loads(doc))
开发者ID:alextricity25,项目名称:marconi,代码行数:11,代码来源:test_queue.py


示例14: test_017_queue_insert_metadata_size65536

    def test_017_queue_insert_metadata_size65536(self):
        """Updates Queue with metadata_size = 65536."""
        url = self.cfg.base_url + '/queues/qtestqueue/metadata'
        doc = functionlib.get_custom_body({"metadatasize": 65536})
        result = http.put(url, self.header, doc)

        self.assertEqual(result.status_code, 204)

        result = http.get(url, self.header)
        self.assertEqual(result.status_code, 200)
        self.assertEqual(result.json(), json.loads(doc))
开发者ID:ozgurakan,项目名称:marconi,代码行数:11,代码来源:test_queue.py


示例15: test_009_queue_insert_header_plaintext

    def test_009_queue_insert_header_plaintext(self):
        """Insert Queue with 'Accept': 'plain/text'."""
        url = self.cfg.base_url + '/queues/plaintextheader'
        header = functionlib.plain_text_in_header()
        doc = '{"queue": "text/plain in header"}'

        result = http.put(url, header, doc)
        self.assertEqual(result.status_code, 406)

        result = http.get(url, self.header)
        self.assertEqual(result.status_code, 404)
开发者ID:alextricity25,项目名称:marconi,代码行数:11,代码来源:test_queue.py


示例16: test_005_queue_insert_invalid_authtoken

    def test_005_queue_insert_invalid_authtoken(self):
        """Insert Queue with invalid authtoken."""
        url = self.cfg.base_url + '/queues/invalidauthtoken'
        header = functionlib.invalid_auth_token_header()
        doc = '{"queue": "invalid auth token"}'

        result = http.put(url, header, doc)
        self.assertEqual(result.status_code, 401)

        result = http.get(url, self.header)
        self.assertEqual(result.status_code, 404)
开发者ID:alextricity25,项目名称:marconi,代码行数:11,代码来源:test_queue.py


示例17: test_003_queue_update_empty_metadata

    def test_003_queue_update_empty_metadata(self):
        """Update Queue with empty metadata."""
        url = self.cfg.base_url + '/queues/qtestqueue'
        doc_original = '{"queue": "Apple"}'
        doc = ''

        result = http.put(url, self.header, doc)
        self.assertEqual(result.status_code, 400)

        result = http.get(url, self.header)
        self.assertEqual(result.status_code, 200)
        self.assertEqual(result.json(), json.loads(doc_original))
开发者ID:alextricity25,项目名称:marconi,代码行数:12,代码来源:test_queue.py


示例18: test_999_delete_queue

    def test_999_delete_queue(self):
        """Delete Queue.

        Deletes Queue & performs GET to confirm 404.
        """
        url = self.cfg.base_url + '/queues/qtestqueue'

        result = http.delete(url, self.header)
        self.assertEqual(result.status_code, 204)

        result = http.get(url, self.header)
        self.assertEqual(result.status_code, 404)
开发者ID:alextricity25,项目名称:marconi,代码行数:12,代码来源:test_queue.py


示例19: test_003_message_get_no_params

    def test_003_message_get_no_params(self):
        """Get Messages with no params."""
        default_msg_count = 10
        url = self.cfg.base_url + '/queues/messagetestqueue/messages'
        result = http.get(url, self.header)

        self.assertEqual(result.status_code, 200)

        test_result_flag = msgfnlib.verify_get_msgs(default_msg_count,
                                                    result.headers,
                                                    result.text)
        self.assertEqual(test_result_flag, True)
开发者ID:BryanSD,项目名称:marconi,代码行数:12,代码来源:test_messages.py


示例20: test_010_queue_insert_header_asterisk

    def test_010_queue_insert_header_asterisk(self):
        """Insert Queue with 'Accept': '*/*'."""
        url = self.cfg.base_url + '/queues/asteriskinheader'
        header = functionlib.asterisk_in_header()
        doc = '{"queue": "*/* in header"}'

        result = http.put(url, header, doc)
        self.assertEqual(result.status_code, 201)

        result = http.get(url, self.header)
        self.assertEqual(result.status_code, 200)

        http.delete(url, self.header)
开发者ID:alextricity25,项目名称:marconi,代码行数:13,代码来源:test_queue.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utility.NodeUtility类代码示例发布时间:2022-05-27
下一篇:
Python tests.expect函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap