def minio_admin(): madmin = MinioAdmin( endpoint=TestConfig.MINIO_ENDPOINT, access_key=TestConfig.MINIO_ACCESS_KEY, secret_key=TestConfig.MINIO_SECRET_KEY, ) # To match test_database on the minio side madmin.add_user("user", "useruser") madmin.add_user("admin", "adminadmin") madmin.group_add("ach", "user") madmin.add_policy("ach", stager_buckets_policy("ach")) madmin.set_policy("ach", group="ach") yield madmin # Teardown try: madmin.remove_user("user") except: pass try: madmin.remove_user("admin") except: pass try: madmin.group_remove("ach") except: pass try: madmin.remove_policy("ach") except: pass
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
def mc(): return MinioAdmin( endpoint=TestConfig.MINIO_ENDPOINT, access_key=TestConfig.MINIO_ACCESS_KEY, secret_key=TestConfig.MINIO_SECRET_KEY, )