Example #1
0
def set_acl_subject(test_set, acl):
    subject, expected, unexpected = test_set
    conn = boto.connect_s3()
    proxy = RadulaProxy(connection=conn)
    radu = Radula(connection=conn)
    proxy.make_bucket(subject=TEST_BUCKET)

    # give something to download
    args = vars(_parse_args(['up']))
    args.update({"subject": TEST_FILE, "target": subject})
    proxy.upload(**args)
    sys.stdout.truncate(0)

    args = vars(_parse_args(['set-acl', subject, acl]))
    radu.set_acl(**args)
    out = [line.strip() for line in sys.stdout.getvalue().split("\n")]
    sys.stdout.truncate(0)

    for msg in expected:
        errmsg = "Expecting log message containing '{0}'".format(msg)
        assert_in(msg, out, msg=errmsg)

    for msg in unexpected:
        errmsg = "Not expecting log message containing '{0}'".format(msg)
        assert_not_in(msg, out, msg=errmsg)
Example #2
0
def set_acl_subject(test_set, acl):
    subject, expected, unexpected = test_set
    conn = boto.connect_s3()
    proxy = RadulaProxy(connection=conn)
    radu = Radula(connection=conn)
    proxy.make_bucket(subject=TEST_BUCKET)

    # give something to download
    args = vars(_parse_args(['up']))
    args.update({
        "subject": TEST_FILE,
        "target": subject
    })
    proxy.upload(**args)
    sys.stdout.truncate(0)

    args = vars(_parse_args(['set-acl', subject, acl]))
    radu.set_acl(**args)
    out = [line.strip() for line in sys.stdout.getvalue().split("\n")]
    sys.stdout.truncate(0)

    for msg in expected:
        errmsg = "Expecting log message containing '{0}'".format(msg)
        assert_in(msg, out, msg=errmsg)

    for msg in unexpected:
        errmsg = "Not expecting log message containing '{0}'".format(msg)
        assert_not_in(msg, out, msg=errmsg)
Example #3
0
def set_acl_canned_fail(acl):
    conn = boto.connect_s3()
    proxy = RadulaProxy(connection=conn)
    radu = Radula(connection=conn)
    proxy.make_bucket(subject=TEST_BUCKET)

    # give something to download
    args = vars(_parse_args(['up']))
    args.update({"subject": TEST_FILE, "target": REMOTE_FILE})
    proxy.upload(**args)
    sys.stdout.truncate(0)

    args = vars(_parse_args(['set-acl', REMOTE_FILE, acl]))
    radu.set_acl(**args)
Example #4
0
def set_acl_canned_fail(acl):
    conn = boto.connect_s3()
    proxy = RadulaProxy(connection=conn)
    radu = Radula(connection=conn)
    proxy.make_bucket(subject=TEST_BUCKET)

    # give something to download
    args = vars(_parse_args(['up']))
    args.update({
        "subject": TEST_FILE,
        "target": REMOTE_FILE
    })
    proxy.upload(**args)
    sys.stdout.truncate(0)

    args = vars(_parse_args(['set-acl', REMOTE_FILE, acl]))
    radu.set_acl(**args)