def test_create_bucket_in_project(db_session, providers): adm.create_bucket_on_project(db_session, "project_with_bucket", "new_bucket", "test-cleversafe") project = db_session.query(Project).filter_by( name="project_with_bucket").first() bucket = db_session.query(Bucket).filter_by(name="new_bucket").first() provider = db_session.query(CloudProvider).filter_by( name="test-cleversafe").first() bucket_in_project = (db_session.query(ProjectToBucket).filter_by( bucket_id=bucket.id, project_id=project.id).first()) assert bucket_in_project != None assert bucket.provider_id == provider.id
def create_bucket_in_project(projectname, bucketname): """ Create a bucket in the selected project. Returns a json object. """ providername = request.get_json().get("provider") response = jsonify( admin.create_bucket_on_project(current_session, projectname, bucketname, providername)) return response