Beispiel #1
0
def test_add_remove_users(mc: MinioAdmin):
    assert len(mc.list_users()) == 0
    mc.add_user("foo", "barbarbar")
    assert len(mc.list_users()) == 1

    foo = mc.get_user("foo")
    assert foo["accessKey"] == "foo"
    assert foo["userStatus"] == "enabled"

    mc.add_user("bar", "foofoofoo")
    assert len(mc.list_users()) == 2

    mc.remove_user("foo")
    mc.remove_user("bar")
    assert len(mc.list_users()) == 0
Beispiel #2
0
def minio_policy():
    # Under normal operations this would already be created by precondition
    madmin = MinioAdmin(
        endpoint=TestConfig.MINIO_ENDPOINT,
        access_key=TestConfig.MINIO_ACCESS_KEY,
        secret_key=TestConfig.MINIO_SECRET_KEY,
    )
    madmin.add_policy("ach", stager_buckets_policy("ach"))
    yield madmin
    try:
        madmin.remove_policy("ach")
    except:
        pass
    for user in madmin.list_users():
        try:
            madmin.remove_user(user["accessKey"])
        except:
            pass