def bucket_info_test(): radu = RadulaProxy(connection=boto.connect_s3()) radu.make_bucket(subject=TEST_BUCKET) sys.stdout.truncate(0) radu.info(subject=TEST_BUCKET) out = sys.stdout.getvalue().strip() info = json.loads(out) for k in ('keys', 'size_human', 'size'): assert_in(k, info) key_info = info.get("keys") for k in ('count', 'largest', 'newest', 'oldest'): assert_in(k, key_info)
def key_info_test(): radu = RadulaProxy(connection=boto.connect_s3()) radu.make_bucket(subject=TEST_BUCKET) # give something to info args = vars(_parse_args(['up'])) remote_file = REMOTE_FILE args.update({ "subject": TEST_FILE, "target": remote_file }) radu.upload(**args) sys.stdout.truncate(0) radu.info(subject=REMOTE_FILE) out = sys.stdout.getvalue().strip() info = json.loads(out) for k in ('content_length', 'owner', 'size', 'bucket'): assert_in(k, info) assert_equal(info.get("bucket"), TEST_BUCKET)
def key_info_bad_subject_test(): radu = RadulaProxy(connection=boto.connect_s3()) radu.make_bucket(subject=TEST_BUCKET) radu.info(subject=REMOTE_FILE)