本文整理匯總了Python中radula.RadulaProxy.keys方法的典型用法代碼示例。如果您正苦於以下問題:Python RadulaProxy.keys方法的具體用法?Python RadulaProxy.keys怎麽用?Python RadulaProxy.keys使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類radula.RadulaProxy
的用法示例。
在下文中一共展示了RadulaProxy.keys方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: rm_method
# 需要導入模塊: from radula import RadulaProxy [as 別名]
# 或者: from radula.RadulaProxy import keys [as 別名]
def rm_method(method):
radu = RadulaProxy(connection=boto.connect_s3())
radu.make_bucket(subject=TEST_BUCKET)
# give something to rm
args = vars(_parse_args(['up']))
expected = []
for i in xrange(3):
remote_file = REMOTE_FILE + str(i)
expected.append(remote_file)
args.update({
"subject": TEST_FILE,
"target": remote_file
})
radu.upload(**args)
while len(expected):
remove_file = expected.pop()
sys.stdout.truncate(0)
getattr(radu, method)(subject=remove_file)
radu.keys(subject=TEST_BUCKET)
keys = [k.strip() for k in sys.stdout.getvalue().strip().split("\n")]
absent_key = os.path.basename(remove_file)
assert_not_in(absent_key, keys, msg="Expecting absence of key mention '{0}'".format(absent_key))
for expected_key in expected:
expected_key = os.path.basename(expected_key)
assert_in(expected_key, keys, msg="Expecting output containing '{0}'".format(expected_key))
示例2: copy_method
# 需要導入模塊: from radula import RadulaProxy [as 別名]
# 或者: from radula.RadulaProxy import keys [as 別名]
def copy_method(method):
handler = TestHandler(Matcher())
logger = logging.getLogger()
logger.addHandler(handler)
radu = RadulaProxy(connection=boto.connect_s3())
radu.make_bucket(subject=TEST_BUCKET)
# give something to download
args = vars(_parse_args(['up']))
args.update({
"subject": TEST_FILE,
"target": REMOTE_FILE
})
radu.upload(**args)
sys.stdout.truncate(0)
# 'threads' needed
args = vars(_parse_args(['-y', method]))
target_file = REMOTE_FILE + '-copy'
args.update({
"subject": REMOTE_FILE,
"target": target_file
})
radu.streaming_copy(**args)
msgs = [
"Finished uploading",
"tests.s3.amazonaws.com/data.txt",
"Download URL",
"Key data matches!"
]
for msg in msgs:
fmt = "Expecting log message containing '{0}'"
assert_true(handler.matches(message=msg), msg=fmt.format(msg))
radu.keys(subject=TEST_BUCKET)
keys = [k.strip() for k in sys.stdout.getvalue().strip().split("\n")]
expected = [REMOTE_FILE, target_file]
fmt = "Expecting output containing '{0}'"
for expected_key in expected:
expected_key = os.path.basename(expected_key)
assert_in(expected_key, keys, msg=fmt.format(expected_key))
示例3: key_test
# 需要導入模塊: from radula import RadulaProxy [as 別名]
# 或者: from radula.RadulaProxy import keys [as 別名]
def key_test():
radu = RadulaProxy(connection=boto.connect_s3())
radu.make_bucket(subject=TEST_BUCKET)
# give something to download
args = vars(_parse_args(['up']))
expected = []
for i in xrange(3):
remote_file = REMOTE_FILE + str(i)
expected.append(remote_file)
args.update({
"subject": TEST_FILE,
"target": remote_file
})
radu.upload(**args)
sys.stdout.truncate(0)
radu.keys(subject=TEST_BUCKET)
keys = [k.strip() for k in sys.stdout.getvalue().strip().split("\n")]
for expected_key in expected:
expected_key = os.path.basename(expected_key)
assert_in(expected_key, keys, msg="Expecting output containing '{0}'".format(expected_key))