def test_delete_bucket_from_project(db_session, providers):
    bucket = db_session.query(Bucket).filter_by(name="first_bucket").first()
    assert bucket != None
    project_to_bucket = (db_session.query(ProjectToBucket).filter_by(
        bucket_id=bucket.id).first())
    assert project_to_bucket != None
    adm.delete_bucket_on_project(db_session, "project_with_bucket",
                                 "first_bucket")
    removed_bucket = db_session.query(Bucket).filter_by(
        name="first_bucket").first()
    assert removed_bucket == None
    project_to_bucket = (db_session.query(ProjectToBucket).filter_by(
        id=bucket.id).first())
    assert project_to_bucket == None
Beispiel #2
0
def delete_bucket_from_project(projectname, bucketname):
    """
    Delete a bucket from the selected project, both
    in the userdatamodel database and in the storage client
    associated with that bucket.
    Returns a json object.
    """
    return jsonify(
        admin.delete_bucket_on_project(current_session, projectname,
                                       bucketname))