本文整理汇总了Python中marconi.tests.system.common.http.get函数的典型用法代码示例。如果您正苦于以下问题:Python get函数的具体用法?Python get怎么用?Python get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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)
示例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
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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))
示例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))
示例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)