API: don't make error messages translatable
This commit is contained in:
parent
04744b4dac
commit
6bbcb7415b
29 changed files with 159 additions and 203 deletions
|
|
@ -23,7 +23,7 @@ module Api
|
|||
if aspect
|
||||
render json: aspect_as_json(aspect, true)
|
||||
else
|
||||
render_error 404, I18n.t("api.endpoint_errors.aspects.not_found")
|
||||
render_error 404, "Aspect with provided ID could not be found"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -33,24 +33,24 @@ module Api
|
|||
if aspect&.save
|
||||
render json: aspect_as_json(aspect, true)
|
||||
else
|
||||
render_error 422, I18n.t("api.endpoint_errors.aspects.cant_create")
|
||||
render_error 422, "Failed to create the aspect"
|
||||
end
|
||||
rescue ActionController::ParameterMissing
|
||||
render_error 422, I18n.t("api.endpoint_errors.aspects.cant_create")
|
||||
render_error 422, "Failed to create the aspect"
|
||||
end
|
||||
|
||||
def update
|
||||
aspect = current_user.aspects.where(id: params[:id]).first
|
||||
|
||||
if !aspect
|
||||
render_error 404, I18n.t("api.endpoint_errors.aspects.cant_update")
|
||||
render_error 404, "Failed to update the aspect"
|
||||
elsif aspect.update!(aspect_params(true))
|
||||
render json: aspect_as_json(aspect, true)
|
||||
else
|
||||
render_error 422, I18n.t("api.endpoint_errors.aspects.cant_update")
|
||||
render_error 422, "Failed to update the aspect"
|
||||
end
|
||||
rescue ActionController::ParameterMissing, ActiveRecord::RecordInvalid
|
||||
render_error 422, I18n.t("api.endpoint_errors.aspects.cant_update")
|
||||
render_error 422, "Failed to update the aspect"
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
@ -58,7 +58,7 @@ module Api
|
|||
if aspect&.destroy
|
||||
head :no_content
|
||||
else
|
||||
render_error 422, I18n.t("api.endpoint_errors.aspects.cant_delete")
|
||||
render_error 422, "Failed to delete the aspect"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -12,18 +12,18 @@ module Api
|
|||
end
|
||||
|
||||
rescue_from ActiveRecord::RecordNotFound do
|
||||
render_error 404, I18n.t("api.endpoint_errors.posts.post_not_found")
|
||||
render_error 404, "Post with provided guid could not be found"
|
||||
end
|
||||
|
||||
rescue_from ActiveRecord::RecordInvalid do
|
||||
render_error 422, I18n.t("api.endpoint_errors.comments.not_allowed")
|
||||
render_error 422, "User is not allowed to comment"
|
||||
end
|
||||
|
||||
def create
|
||||
find_post
|
||||
comment = comment_service.create(params.require(:post_id), params.require(:body))
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_error 404, I18n.t("api.endpoint_errors.posts.post_not_found")
|
||||
render_error 404, "Post with provided guid could not be found"
|
||||
else
|
||||
render json: comment_as_json(comment), status: :created
|
||||
end
|
||||
|
|
@ -45,7 +45,7 @@ module Api
|
|||
head :no_content
|
||||
end
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
render_error 403, I18n.t("api.endpoint_errors.comments.no_delete")
|
||||
render_error 403, "User not allowed to delete the comment"
|
||||
end
|
||||
|
||||
def report
|
||||
|
|
@ -64,7 +64,7 @@ module Api
|
|||
if report.save
|
||||
head :no_content
|
||||
else
|
||||
render_error 409, I18n.t("api.endpoint_errors.comments.duplicate_report")
|
||||
render_error 409, "This item already has been reported by this user"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -72,10 +72,10 @@ module Api
|
|||
|
||||
def comment_and_post_validate(post_guid, comment_guid)
|
||||
if !comment_exists(comment_guid)
|
||||
render_error 404, I18n.t("api.endpoint_errors.comments.not_found")
|
||||
render_error 404, "Comment not found for the given post"
|
||||
false
|
||||
elsif !comment_is_for_post(post_guid, comment_guid)
|
||||
render_error 404, I18n.t("api.endpoint_errors.comments.not_found")
|
||||
render_error 404, "Comment not found for the given post"
|
||||
false
|
||||
else
|
||||
true
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ module Api
|
|||
end
|
||||
|
||||
rescue_from ActiveRecord::RecordNotFound do
|
||||
render_error 404, I18n.t("api.endpoint_errors.aspects.not_found")
|
||||
render_error 404, "Aspect with provided ID could not be found"
|
||||
end
|
||||
|
||||
def index
|
||||
|
|
@ -34,10 +34,10 @@ module Api
|
|||
if aspect_membership
|
||||
head :no_content
|
||||
else
|
||||
render_error 422, I18n.t("api.endpoint_errors.contacts.cant_create")
|
||||
render_error 422, "Failed to add user to aspect"
|
||||
end
|
||||
rescue ActiveRecord::RecordNotUnique
|
||||
render_error 422, I18n.t("api.endpoint_errors.contacts.cant_create")
|
||||
render_error 422, "Failed to add user to aspect"
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
@ -48,10 +48,10 @@ module Api
|
|||
if result && result[:success]
|
||||
head :no_content
|
||||
else
|
||||
render_error 422, I18n.t("api.endpoint_errors.contacts.cant_delete")
|
||||
render_error 422, "Failed to remove user from aspect"
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_error 404, I18n.t("api.endpoint_errors.contacts.not_found")
|
||||
render_error 404, "Aspect or contact on aspect not found"
|
||||
end
|
||||
|
||||
def aspects_membership_service
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ module Api
|
|||
end
|
||||
|
||||
rescue_from ActiveRecord::RecordNotFound do
|
||||
render_error 404, I18n.t("api.endpoint_errors.conversations.not_found")
|
||||
render_error 404, "Conversation with provided guid could not be found"
|
||||
end
|
||||
|
||||
def index
|
||||
|
|
@ -40,7 +40,7 @@ module Api
|
|||
Diaspora::Federation::Dispatcher.defer_dispatch(current_user, conversation)
|
||||
render json: conversation_as_json(conversation), status: :created
|
||||
rescue ActiveRecord::RecordInvalid, ActionController::ParameterMissing, ActiveRecord::RecordNotFound
|
||||
render_error 422, I18n.t("api.endpoint_errors.conversations.cant_process")
|
||||
render_error 422, "Couldn’t accept or process the conversation"
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ module Api
|
|||
end
|
||||
|
||||
rescue_from ActiveRecord::RecordNotFound do
|
||||
render_error 404, I18n.t("api.endpoint_errors.posts.post_not_found")
|
||||
render_error 404, "Post with provided guid could not be found"
|
||||
end
|
||||
|
||||
rescue_from ActiveRecord::RecordInvalid do
|
||||
render_error 422, I18n.t("api.endpoint_errors.likes.user_not_allowed_to_like")
|
||||
render_error 422, "User is not allowed to like"
|
||||
end
|
||||
|
||||
def show
|
||||
|
|
@ -36,7 +36,7 @@ module Api
|
|||
like_service.create(params[:post_id])
|
||||
rescue ActiveRecord::RecordInvalid => e
|
||||
if e.message == "Validation failed: Target has already been taken"
|
||||
return render_error 409, I18n.t("api.endpoint_errors.likes.like_exists")
|
||||
return render_error 409, "Like already exists"
|
||||
end
|
||||
|
||||
raise
|
||||
|
|
@ -52,7 +52,7 @@ module Api
|
|||
if success
|
||||
head :no_content
|
||||
else
|
||||
render_error 410, I18n.t("api.endpoint_errors.likes.no_like")
|
||||
render_error 410, "Like doesn’t exist"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ module Api
|
|||
end
|
||||
|
||||
rescue_from ActiveRecord::RecordNotFound do
|
||||
render_error 404, I18n.t("api.endpoint_errors.conversations.not_found")
|
||||
render_error 404, "Conversation with provided guid could not be found"
|
||||
end
|
||||
|
||||
def create
|
||||
|
|
@ -19,7 +19,7 @@ module Api
|
|||
Diaspora::Federation::Dispatcher.defer_dispatch(current_user, message)
|
||||
render json: message_json(message), status: :created
|
||||
rescue ActionController::ParameterMissing
|
||||
render_error 422, I18n.t("api.endpoint_errors.conversations.cant_process")
|
||||
render_error 422, "Couldn’t accept or process the conversation"
|
||||
end
|
||||
|
||||
def index
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ module Api
|
|||
end
|
||||
|
||||
rescue_from ActiveRecord::RecordNotFound do
|
||||
render_error 404, I18n.t("api.endpoint_errors.notifications.not_found")
|
||||
render_error 404, "Notification with provided guid could not be found"
|
||||
end
|
||||
|
||||
def show
|
||||
|
|
@ -17,7 +17,7 @@ module Api
|
|||
if notification
|
||||
render json: NotificationPresenter.new(notification).as_api_json(true)
|
||||
else
|
||||
render_error 404, I18n.t("api.endpoint_errors.notifications.not_found")
|
||||
render_error 404, "Notification with provided guid could not be found"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ module Api
|
|||
end
|
||||
render_paged_api_response notifications_page
|
||||
rescue ArgumentError
|
||||
render_error 422, I18n.t("api.endpoint_errors.notifications.cant_process")
|
||||
render_error 422, "Couldnt process the notifications requestt process the notifications request"
|
||||
end
|
||||
|
||||
def update
|
||||
|
|
@ -39,10 +39,10 @@ module Api
|
|||
if service.update_status_by_guid(params[:id], read)
|
||||
head :no_content
|
||||
else
|
||||
render_error 422, I18n.t("api.endpoint_errors.notifications.cant_process")
|
||||
render_error 422, "Couldnt process the notifications requestt process the notifications request"
|
||||
end
|
||||
rescue ActionController::ParameterMissing
|
||||
render_error 422, I18n.t("api.endpoint_errors.notifications.cant_process")
|
||||
render_error 422, "Couldnt process the notifications requestt process the notifications request"
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ module Api
|
|||
end
|
||||
|
||||
rescue_from ActiveRecord::RecordNotFound do
|
||||
render_error 404, I18n.t("api.endpoint_errors.photos.not_found")
|
||||
render_error 404, "Photo with provided guid could not be found"
|
||||
end
|
||||
|
||||
def index
|
||||
|
|
@ -46,7 +46,7 @@ module Api
|
|||
|
||||
render json: photo_json(photo)
|
||||
rescue CarrierWave::IntegrityError, ActionController::ParameterMissing, RuntimeError
|
||||
render_error 422, I18n.t("api.endpoint_errors.photos.failed_create")
|
||||
render_error 422, "Failed to create the photo"
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
@ -58,7 +58,7 @@ module Api
|
|||
if current_user.retract(photo)
|
||||
head :no_content
|
||||
else
|
||||
render_error 422, I18n.t("api.endpoint_errors.photos.failed_delete")
|
||||
render_error 422, "Not allowed to delete the photo"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ module Api
|
|||
end
|
||||
|
||||
rescue_from ActiveRecord::RecordNotFound do
|
||||
render_error 404, I18n.t("api.endpoint_errors.posts.post_not_found")
|
||||
render_error 404, "Post with provided guid could not be found"
|
||||
end
|
||||
|
||||
def subscribe
|
||||
|
|
@ -20,7 +20,7 @@ module Api
|
|||
current_user.participate!(post)
|
||||
head :no_content
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
render_error 422, I18n.t("api.endpoint_errors.interactions.cant_subscribe")
|
||||
render_error 422, "Cannot subscribe to this post"
|
||||
end
|
||||
|
||||
def hide
|
||||
|
|
@ -49,10 +49,10 @@ module Api
|
|||
if report.save
|
||||
head :no_content
|
||||
else
|
||||
render_error 409, I18n.t("api.endpoint_errors.posts.cant_report")
|
||||
render_error 409, "Failed to create report on this post"
|
||||
end
|
||||
rescue ActionController::ParameterMissing
|
||||
render_error 422, I18n.t("api.endpoint_errors.posts.cant_report")
|
||||
render_error 422, "Failed to create report on this post"
|
||||
end
|
||||
|
||||
def vote
|
||||
|
|
@ -66,10 +66,10 @@ module Api
|
|||
if poll_vote
|
||||
head :no_content
|
||||
else
|
||||
render_error 422, I18n.t("api.endpoint_errors.interactions.cant_vote")
|
||||
render_error 422, "Cant vote on this post"
|
||||
end
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
render_error 422, I18n.t("api.endpoint_errors.interactions.cant_vote")
|
||||
render_error 422, "Cant vote on this post"
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ module Api
|
|||
end
|
||||
|
||||
rescue_from ActiveRecord::RecordNotFound do
|
||||
render_error 404, I18n.t("api.endpoint_errors.posts.post_not_found")
|
||||
render_error 404, "Post with provided guid could not be found"
|
||||
end
|
||||
|
||||
def show
|
||||
|
|
@ -31,14 +31,14 @@ module Api
|
|||
@status_message = creation_service.create(creation_params)
|
||||
render json: PostPresenter.new(@status_message, current_user).as_api_response
|
||||
rescue StandardError
|
||||
render_error 422, I18n.t("api.endpoint_errors.posts.failed_create")
|
||||
render_error 422, "Failed to create the post"
|
||||
end
|
||||
|
||||
def destroy
|
||||
post_service.destroy(params[:id], private_modify?)
|
||||
head :no_content
|
||||
rescue Diaspora::NotMine, Diaspora::NonPublic
|
||||
render_error 403, I18n.t("api.endpoint_errors.posts.failed_delete")
|
||||
render_error 403, "Not allowed to delete the post"
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ module Api
|
|||
end
|
||||
|
||||
rescue_from ActiveRecord::RecordNotFound do
|
||||
render_error 404, I18n.t("api.endpoint_errors.posts.post_not_found")
|
||||
render_error 404, "Post with provided guid could not be found"
|
||||
end
|
||||
|
||||
rescue_from Diaspora::NonPublic do
|
||||
render_error 404, I18n.t("api.endpoint_errors.posts.post_not_found")
|
||||
render_error 404, "Post with provided guid could not be found"
|
||||
end
|
||||
|
||||
def show
|
||||
|
|
@ -35,9 +35,9 @@ module Api
|
|||
def create
|
||||
reshare = reshare_service.create(params.require(:post_id))
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
render_error 409, I18n.t("reshares.create.error")
|
||||
render_error 409, "Reshare already exists"
|
||||
rescue ActiveRecord::RecordNotFound, RuntimeError
|
||||
render_error 422, I18n.t("reshares.create.error")
|
||||
render_error 422, "Failed to reshare"
|
||||
else
|
||||
render json: PostPresenter.new(reshare, current_user).as_api_response
|
||||
end
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ module Api
|
|||
end
|
||||
|
||||
rescue_from ActionController::ParameterMissing, RuntimeError do
|
||||
render_error 422, I18n.t("api.endpoint_errors.search.cant_process")
|
||||
render_error 422, "Search request could not be processed"
|
||||
end
|
||||
|
||||
def user_index
|
||||
|
|
|
|||
|
|
@ -19,16 +19,16 @@ module Api
|
|||
tag_followings_service.create(params.require(:name))
|
||||
head :no_content
|
||||
rescue TagFollowingService::DuplicateTag
|
||||
render_error 409, I18n.t("api.endpoint_errors.tags.cant_process")
|
||||
render_error 409, "Already following this tag"
|
||||
rescue StandardError
|
||||
render_error 422, I18n.t("api.endpoint_errors.tags.cant_process")
|
||||
render_error 422, "Failed to process the tag followings request"
|
||||
end
|
||||
|
||||
def destroy
|
||||
tag_followings_service.destroy_by_name(params.require(:id))
|
||||
head :no_content
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_error 410, I18n.t("api.endpoint_errors.tags.cant_process")
|
||||
render_error 410, "Not following this tag"
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ module Api
|
|||
end
|
||||
|
||||
rescue_from ActiveRecord::RecordNotFound do
|
||||
render_error 404, I18n.t("api.endpoint_errors.users.not_found")
|
||||
render_error 404, "User not found"
|
||||
end
|
||||
|
||||
def show
|
||||
|
|
@ -42,15 +42,15 @@ module Api
|
|||
if params_to_update && current_user.update_profile(params_to_update)
|
||||
render json: PersonPresenter.new(current_user.person, current_user).profile_hash_as_api_json
|
||||
else
|
||||
render_error 422, I18n.t("api.endpoint_errors.users.cant_update")
|
||||
render_error 422, "Failed to update the user settings"
|
||||
end
|
||||
rescue RuntimeError
|
||||
render_error 422, I18n.t("api.endpoint_errors.users.cant_update")
|
||||
render_error 422, "Failed to update the user settings"
|
||||
end
|
||||
|
||||
def contacts
|
||||
if params.require(:user_id) != current_user.guid
|
||||
render_error 404, I18n.t("api.endpoint_errors.users.not_found")
|
||||
render_error 404, "User not found"
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -984,50 +984,6 @@ en:
|
|||
contact_developer: "You should contact the developer of the application and include the following detailed error message:"
|
||||
login_required: "You must first login before you can authorize this application"
|
||||
could_not_authorize: "The application could not be authorized"
|
||||
endpoint_errors:
|
||||
aspects:
|
||||
cant_create: "Failed to create the aspect"
|
||||
cant_delete: "Failed to delete the aspect"
|
||||
cant_update: "Failed to update the aspect"
|
||||
not_found: "Aspect with provided ID could not be found"
|
||||
conversations:
|
||||
not_found: "Conversation with provided guid could not be found"
|
||||
cant_process: "Couldn’t accept or process the conversation"
|
||||
comments:
|
||||
not_found: "Comment not found for the given post"
|
||||
not_allowed: "User is not allowed to comment"
|
||||
no_delete: "User not allowed to delete the comment"
|
||||
duplicate_report: "This item already has been reported by this user"
|
||||
contacts:
|
||||
not_found: "Aspect or contact on aspect not found"
|
||||
cant_create: "Failed to add user to aspect"
|
||||
cant_delete: "Failed to remove user from aspect"
|
||||
likes:
|
||||
user_not_allowed_to_like: "User is not allowed to like"
|
||||
like_exists: "Like already exists"
|
||||
no_like: "Like doesn’t exist"
|
||||
interactions:
|
||||
cant_subscribe: "Can't subscribe to this post"
|
||||
cant_vote: "Can't vote on this post"
|
||||
notifications:
|
||||
not_found: "Notification with provided guid could not be found"
|
||||
cant_process: "Couldn't process the notifications request"
|
||||
photos:
|
||||
not_found: "Photo with provided guid could not be found"
|
||||
failed_create: "Failed to create the photo"
|
||||
failed_delete: "Not allowed to delete the photo"
|
||||
posts:
|
||||
post_not_found: "Post with provided guid could not be found"
|
||||
failed_create: "Failed to create the post"
|
||||
failed_delete: "Not allowed to delete the post"
|
||||
cant_report: "Failed to create report on this post"
|
||||
users:
|
||||
cant_update: "Failed to update the user settings"
|
||||
not_found: "User not found"
|
||||
search:
|
||||
cant_process: "Search request could not be processed"
|
||||
tags:
|
||||
cant_process: "Failed to process the tag followings request"
|
||||
|
||||
error:
|
||||
not_found: "No record found for given id."
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ describe Api::V1::AspectsController do
|
|||
api_v1_aspect_path("-1"),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.aspects.not_found"))
|
||||
confirm_api_error(response, 404, "Aspect with provided ID could not be found")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -136,7 +136,7 @@ describe Api::V1::AspectsController do
|
|||
params: {name: @aspect1.name, access_token: access_token}
|
||||
)
|
||||
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.aspects.cant_create"))
|
||||
confirm_api_error(response, 422, "Failed to create the aspect")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ describe Api::V1::AspectsController do
|
|||
params: {order: 0, access_token: access_token}
|
||||
)
|
||||
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.aspects.cant_create"))
|
||||
confirm_api_error(response, 422, "Failed to create the aspect")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -234,7 +234,7 @@ describe Api::V1::AspectsController do
|
|||
params: {name: @aspect1.name, access_token: access_token}
|
||||
)
|
||||
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.aspects.cant_update"))
|
||||
confirm_api_error(response, 422, "Failed to update the aspect")
|
||||
end
|
||||
|
||||
it "fails with bad id" do
|
||||
|
|
@ -243,7 +243,7 @@ describe Api::V1::AspectsController do
|
|||
params: {name: "NewAspectName", access_token: access_token}
|
||||
)
|
||||
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.aspects.cant_update"))
|
||||
confirm_api_error(response, 404, "Failed to update the aspect")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -284,7 +284,7 @@ describe Api::V1::AspectsController do
|
|||
api_v1_aspect_path("-1"),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.aspects.cant_delete"))
|
||||
confirm_api_error(response, 422, "Failed to delete the aspect")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ describe Api::V1::CommentsController do
|
|||
api_v1_post_comments_path(post_id: "999_999_999"),
|
||||
params: {body: "text", access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ describe Api::V1::CommentsController do
|
|||
api_v1_post_comments_path(post_id: @private_post.guid),
|
||||
params: {body: "comment text", access_token: access_token_public_only}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
|
||||
it "fails without interactions scope" do
|
||||
|
|
@ -152,7 +152,7 @@ describe Api::V1::CommentsController do
|
|||
api_v1_post_comments_path(post_id: "999_999_999"),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -162,7 +162,7 @@ describe Api::V1::CommentsController do
|
|||
api_v1_post_comments_path(post_id: @private_post.guid),
|
||||
params: {access_token: access_token_public_only}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
|
||||
it "fails without valid token" do
|
||||
|
|
@ -206,7 +206,7 @@ describe Api::V1::CommentsController do
|
|||
),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -232,7 +232,7 @@ describe Api::V1::CommentsController do
|
|||
),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.comments.not_found"))
|
||||
confirm_api_error(response, 404, "Comment not found for the given post")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -246,7 +246,7 @@ describe Api::V1::CommentsController do
|
|||
),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 403, I18n.t("api.endpoint_errors.comments.no_delete"))
|
||||
confirm_api_error(response, 403, "User not allowed to delete the comment")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -309,7 +309,7 @@ describe Api::V1::CommentsController do
|
|||
access_token: access_token
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.comments.not_found"))
|
||||
confirm_api_error(response, 404, "Comment not found for the given post")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -325,7 +325,7 @@ describe Api::V1::CommentsController do
|
|||
access_token: access_token
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -341,7 +341,7 @@ describe Api::V1::CommentsController do
|
|||
access_token: access_token
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -357,7 +357,7 @@ describe Api::V1::CommentsController do
|
|||
access_token: access_token
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.comments.not_found"))
|
||||
confirm_api_error(response, 404, "Comment not found for the given post")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -385,7 +385,7 @@ describe Api::V1::CommentsController do
|
|||
access_token: access_token
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 409, I18n.t("api.endpoint_errors.comments.duplicate_report"))
|
||||
confirm_api_error(response, 409, "This item already has been reported by this user")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -401,7 +401,7 @@ describe Api::V1::CommentsController do
|
|||
access_token: access_token_public_only
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
|
||||
it "fails without valid token" do
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ describe Api::V1::ContactsController do
|
|||
api_v1_aspect_contacts_path(-1),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.aspects.not_found"))
|
||||
confirm_api_error(response, 404, "Aspect with provided ID could not be found")
|
||||
end
|
||||
|
||||
it "fails for other user's Aspect ID" do
|
||||
|
|
@ -76,7 +76,7 @@ describe Api::V1::ContactsController do
|
|||
api_v1_aspect_contacts_path(@eve_aspect.id),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.aspects.not_found"))
|
||||
confirm_api_error(response, 404, "Aspect with provided ID could not be found")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ describe Api::V1::ContactsController do
|
|||
api_v1_aspect_contacts_path(@aspect2.id),
|
||||
params: {person_guid: alice.guid, access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.contacts.cant_create"))
|
||||
confirm_api_error(response, 422, "Failed to add user to aspect")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ describe Api::V1::ContactsController do
|
|||
api_v1_aspect_contacts_path(-1),
|
||||
params: {person_guid: alice.guid, access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.aspects.not_found"))
|
||||
confirm_api_error(response, 404, "Aspect with provided ID could not be found")
|
||||
end
|
||||
|
||||
it "fails for other user's Aspect ID" do
|
||||
|
|
@ -135,7 +135,7 @@ describe Api::V1::ContactsController do
|
|||
api_v1_aspect_contacts_path(@eve_aspect.id),
|
||||
params: {person_guid: alice.guid, access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.aspects.not_found"))
|
||||
confirm_api_error(response, 404, "Aspect with provided ID could not be found")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ describe Api::V1::ContactsController do
|
|||
api_v1_aspect_contacts_path(@aspect2.id),
|
||||
params: {person_guid: "999_999_999", access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.contacts.cant_create"))
|
||||
confirm_api_error(response, 422, "Failed to add user to aspect")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -188,7 +188,7 @@ describe Api::V1::ContactsController do
|
|||
api_v1_aspect_contact_path(@aspect2.id, eve.guid),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.contacts.not_found"))
|
||||
confirm_api_error(response, 404, "Aspect or contact on aspect not found")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -198,7 +198,7 @@ describe Api::V1::ContactsController do
|
|||
api_v1_aspect_contact_path(-1, eve.guid),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.contacts.not_found"))
|
||||
confirm_api_error(response, 404, "Aspect or contact on aspect not found")
|
||||
end
|
||||
|
||||
it "fails for other user's Aspect ID" do
|
||||
|
|
@ -206,7 +206,7 @@ describe Api::V1::ContactsController do
|
|||
api_v1_aspect_contact_path(@eve_aspect.id, eve.guid),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.contacts.not_found"))
|
||||
confirm_api_error(response, 404, "Aspect or contact on aspect not found")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -216,7 +216,7 @@ describe Api::V1::ContactsController do
|
|||
api_v1_aspect_contact_path(@aspect2.id, "999_999_999"),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.contacts.cant_delete"))
|
||||
confirm_api_error(response, 422, "Failed to remove user from aspect")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ describe Api::V1::ConversationsController do
|
|||
context "without valid data" do
|
||||
it "fails with empty body" do
|
||||
post api_v1_conversations_path, params: {access_token: access_token}
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.conversations.cant_process"))
|
||||
confirm_api_error(response, 422, "Couldn’t accept or process the conversation")
|
||||
end
|
||||
|
||||
it "fails with missing subject " do
|
||||
|
|
@ -67,7 +67,7 @@ describe Api::V1::ConversationsController do
|
|||
access_token: access_token
|
||||
}
|
||||
post api_v1_conversations_path, params: incomplete_conversation
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.conversations.cant_process"))
|
||||
confirm_api_error(response, 422, "Couldn’t accept or process the conversation")
|
||||
end
|
||||
|
||||
it "fails with missing body " do
|
||||
|
|
@ -77,7 +77,7 @@ describe Api::V1::ConversationsController do
|
|||
access_token: access_token
|
||||
}
|
||||
post api_v1_conversations_path, params: incomplete_conversation
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.conversations.cant_process"))
|
||||
confirm_api_error(response, 422, "Couldn’t accept or process the conversation")
|
||||
end
|
||||
|
||||
it "fails with missing recipients " do
|
||||
|
|
@ -87,7 +87,7 @@ describe Api::V1::ConversationsController do
|
|||
access_token: access_token
|
||||
}
|
||||
post api_v1_conversations_path, params: incomplete_conversation
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.conversations.cant_process"))
|
||||
confirm_api_error(response, 422, "Couldn’t accept or process the conversation")
|
||||
end
|
||||
|
||||
it "fails with bad recipient ID " do
|
||||
|
|
@ -98,7 +98,7 @@ describe Api::V1::ConversationsController do
|
|||
access_token: access_token
|
||||
}
|
||||
post api_v1_conversations_path, params: incomplete_conversation
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.conversations.cant_process"))
|
||||
confirm_api_error(response, 422, "Couldn’t accept or process the conversation")
|
||||
end
|
||||
|
||||
it "fails with invalid recipient (not allowed to message) " do
|
||||
|
|
@ -109,7 +109,7 @@ describe Api::V1::ConversationsController do
|
|||
access_token: access_token
|
||||
}
|
||||
post api_v1_conversations_path, params: incomplete_conversation
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.conversations.cant_process"))
|
||||
confirm_api_error(response, 422, "Couldn’t accept or process the conversation")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -231,7 +231,7 @@ describe Api::V1::ConversationsController do
|
|||
api_v1_conversation_path(-1),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.conversations.not_found"))
|
||||
confirm_api_error(response, 404, "Conversation with provided guid could not be found")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -284,7 +284,7 @@ describe Api::V1::ConversationsController do
|
|||
@conversation_guid,
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.conversations.not_found"))
|
||||
confirm_api_error(response, 404, "Conversation with provided guid could not be found")
|
||||
get api_v1_conversation_path(
|
||||
@conversation_guid,
|
||||
params: {access_token: access_token_participant}
|
||||
|
|
@ -309,7 +309,7 @@ describe Api::V1::ConversationsController do
|
|||
@conversation_guid,
|
||||
params: {access_token: access_token_participant}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.conversations.not_found"))
|
||||
confirm_api_error(response, 404, "Conversation with provided guid could not be found")
|
||||
|
||||
expect {
|
||||
Conversation.find(guid: @conversation_guid)
|
||||
|
|
@ -323,7 +323,7 @@ describe Api::V1::ConversationsController do
|
|||
api_v1_conversation_path(42),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.conversations.not_found"))
|
||||
confirm_api_error(response, 404, "Conversation with provided guid could not be found")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ describe Api::V1::LikesController do
|
|||
api_v1_post_likes_path(post_id: "badguid"),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ describe Api::V1::LikesController do
|
|||
api_v1_post_likes_path(post_id: @private_status.guid),
|
||||
params: {access_token: access_token_public_only}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.likes.user_not_allowed_to_like"))
|
||||
confirm_api_error(response, 422, "User is not allowed to like")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ describe Api::V1::LikesController do
|
|||
api_v1_post_likes_path(post_id: @status.guid),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 409, I18n.t("api.endpoint_errors.likes.like_exists"))
|
||||
confirm_api_error(response, 409, "Like already exists")
|
||||
|
||||
likes = like_service.find_for_post(@status.guid)
|
||||
expect(likes.length).to eq(1)
|
||||
|
|
@ -148,7 +148,7 @@ describe Api::V1::LikesController do
|
|||
api_v1_post_likes_path(post_id: 99_999_999),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -206,7 +206,7 @@ describe Api::V1::LikesController do
|
|||
api_v1_post_likes_path(post_id: @status.guid),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 410, I18n.t("api.endpoint_errors.likes.no_like"))
|
||||
confirm_api_error(response, 410, "Like doesn’t exist")
|
||||
|
||||
likes = like_service.find_for_post(@status.guid)
|
||||
expect(likes.length).to eq(0)
|
||||
|
|
@ -219,7 +219,7 @@ describe Api::V1::LikesController do
|
|||
api_v1_post_likes_path(post_id: 99_999_999),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -230,7 +230,7 @@ describe Api::V1::LikesController do
|
|||
api_v1_post_likes_path(post_id: @private_status.guid),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
|
||||
it "fails in unliking post without interactions" do
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ describe Api::V1::MessagesController do
|
|||
api_v1_conversation_messages_path(@conversation_guid),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.conversations.cant_process"))
|
||||
confirm_api_error(response, 422, "Couldn’t accept or process the conversation")
|
||||
end
|
||||
|
||||
it "empty string returns a unprocessable entity (422)" do
|
||||
|
|
@ -79,7 +79,7 @@ describe Api::V1::MessagesController do
|
|||
api_v1_conversation_messages_path(@conversation_guid),
|
||||
params: {body: "", access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.conversations.cant_process"))
|
||||
confirm_api_error(response, 422, "Couldn’t accept or process the conversation")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ describe Api::V1::MessagesController do
|
|||
api_v1_conversation_messages_path(42),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.conversations.not_found"))
|
||||
confirm_api_error(response, 404, "Conversation with provided guid could not be found")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ describe Api::V1::NotificationsController do
|
|||
api_v1_notifications_path,
|
||||
params: {only_after: "January 1, 2018", access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.notifications.cant_process"))
|
||||
confirm_api_error(response, 422, "Couldnt process the notifications requestt process the notifications request")
|
||||
end
|
||||
|
||||
it "with insufficient credentials" do
|
||||
|
|
@ -129,7 +129,7 @@ describe Api::V1::NotificationsController do
|
|||
api_v1_notification_path("999_999_999"),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.notifications.not_found"))
|
||||
confirm_api_error(response, 404, "Notification with provided guid could not be found")
|
||||
end
|
||||
|
||||
it "on someone else's notification" do
|
||||
|
|
@ -145,7 +145,7 @@ describe Api::V1::NotificationsController do
|
|||
api_v1_notification_path(alice_notification.guid),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.notifications.not_found"))
|
||||
confirm_api_error(response, 404, "Notification with provided guid could not be found")
|
||||
end
|
||||
|
||||
it "with insufficient credentials" do
|
||||
|
|
@ -190,7 +190,7 @@ describe Api::V1::NotificationsController do
|
|||
api_v1_notification_path("999_999_999"),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.notifications.cant_process"))
|
||||
confirm_api_error(response, 422, "Couldnt process the notifications requestt process the notifications request")
|
||||
end
|
||||
|
||||
it "with proper missing read field" do
|
||||
|
|
@ -198,7 +198,7 @@ describe Api::V1::NotificationsController do
|
|||
api_v1_notification_path(@notification.guid),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.notifications.cant_process"))
|
||||
confirm_api_error(response, 422, "Couldnt process the notifications requestt process the notifications request")
|
||||
end
|
||||
|
||||
it "with insufficient credentials" do
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ describe Api::V1::PhotosController do
|
|||
api_v1_photo_path(@shared_photo1.guid),
|
||||
params: {access_token: access_token_public_only_read_only}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.photos.not_found"))
|
||||
confirm_api_error(response, 404, "Photo with provided guid could not be found")
|
||||
end
|
||||
|
||||
it "with other user's private photo" do
|
||||
|
|
@ -117,7 +117,7 @@ describe Api::V1::PhotosController do
|
|||
api_v1_photo_path(@private_photo1.guid),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.photos.not_found"))
|
||||
confirm_api_error(response, 404, "Photo with provided guid could not be found")
|
||||
end
|
||||
|
||||
it "with invalid GUID" do
|
||||
|
|
@ -125,7 +125,7 @@ describe Api::V1::PhotosController do
|
|||
api_v1_photo_path("999_999_999"),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.photos.not_found"))
|
||||
confirm_api_error(response, 404, "Photo with provided guid could not be found")
|
||||
end
|
||||
|
||||
it "with invalid access token" do
|
||||
|
|
@ -241,7 +241,7 @@ describe Api::V1::PhotosController do
|
|||
api_v1_photos_path,
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.photos.failed_create"))
|
||||
confirm_api_error(response, 422, "Failed to create the photo")
|
||||
end
|
||||
|
||||
it "with non-image file" do
|
||||
|
|
@ -253,7 +253,7 @@ describe Api::V1::PhotosController do
|
|||
api_v1_photos_path,
|
||||
params: {image: text_file, access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.photos.failed_create"))
|
||||
confirm_api_error(response, 422, "Failed to create the photo")
|
||||
end
|
||||
|
||||
it "with impromperly identified file" do
|
||||
|
|
@ -265,7 +265,7 @@ describe Api::V1::PhotosController do
|
|||
api_v1_photos_path,
|
||||
params: {image: text_file, access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.photos.failed_create"))
|
||||
confirm_api_error(response, 422, "Failed to create the photo")
|
||||
end
|
||||
|
||||
it "with invalid access token" do
|
||||
|
|
@ -313,7 +313,7 @@ describe Api::V1::PhotosController do
|
|||
api_v1_photo_path(@alice_public_photo.guid),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.photos.not_found"))
|
||||
confirm_api_error(response, 404, "Photo with provided guid could not be found")
|
||||
end
|
||||
|
||||
it "with other invalid GUID" do
|
||||
|
|
@ -321,7 +321,7 @@ describe Api::V1::PhotosController do
|
|||
api_v1_photo_path("999_999_999"),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.photos.not_found"))
|
||||
confirm_api_error(response, 404, "Photo with provided guid could not be found")
|
||||
end
|
||||
|
||||
it "with invalid access token" do
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ describe Api::V1::PostInteractionsController do
|
|||
access_token: access_token
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
|
||||
it "with insufficient token" do
|
||||
|
|
@ -140,7 +140,7 @@ describe Api::V1::PostInteractionsController do
|
|||
access_token: access_token
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
|
||||
it "with insufficient token" do
|
||||
|
|
@ -208,7 +208,7 @@ describe Api::V1::PostInteractionsController do
|
|||
access_token: access_token
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
|
||||
it "when not subscribed already" do
|
||||
|
|
@ -285,7 +285,7 @@ describe Api::V1::PostInteractionsController do
|
|||
access_token: access_token
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
|
||||
it "when already reported" do
|
||||
|
|
@ -304,7 +304,7 @@ describe Api::V1::PostInteractionsController do
|
|||
access_token: access_token
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 409, I18n.t("api.endpoint_errors.posts.cant_report"))
|
||||
confirm_api_error(response, 409, "Failed to create report on this post")
|
||||
end
|
||||
|
||||
it "when missing reason" do
|
||||
|
|
@ -314,7 +314,7 @@ describe Api::V1::PostInteractionsController do
|
|||
access_token: access_token
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.posts.cant_report"))
|
||||
confirm_api_error(response, 422, "Failed to create report on this post")
|
||||
end
|
||||
|
||||
it "with insufficient token" do
|
||||
|
|
@ -389,7 +389,7 @@ describe Api::V1::PostInteractionsController do
|
|||
access_token: access_token
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.interactions.cant_vote"))
|
||||
confirm_api_error(response, 422, "Cant vote on this post")
|
||||
end
|
||||
|
||||
it "fails with bad answer id" do
|
||||
|
|
@ -400,7 +400,7 @@ describe Api::V1::PostInteractionsController do
|
|||
access_token: access_token
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.interactions.cant_vote"))
|
||||
confirm_api_error(response, 422, "Cant vote on this post")
|
||||
end
|
||||
|
||||
it "fails with bad post id" do
|
||||
|
|
@ -411,7 +411,7 @@ describe Api::V1::PostInteractionsController do
|
|||
access_token: access_token
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
|
||||
it "with insufficient token" do
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ describe Api::V1::PostsController do
|
|||
access_token: access_token
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ describe Api::V1::PostsController do
|
|||
access_token: access_token_public_only_read_only
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
|
||||
get(
|
||||
api_v1_post_path(shared_post.guid),
|
||||
|
|
@ -165,7 +165,7 @@ describe Api::V1::PostsController do
|
|||
access_token: access_token
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -319,7 +319,7 @@ describe Api::V1::PostsController do
|
|||
photos: ["999_999_999"]
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.posts.failed_create"))
|
||||
confirm_api_error(response, 422, "Failed to create the post")
|
||||
end
|
||||
|
||||
it "creates with poll" do
|
||||
|
|
@ -360,7 +360,7 @@ describe Api::V1::PostsController do
|
|||
}
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.posts.failed_create"))
|
||||
confirm_api_error(response, 422, "Failed to create the post")
|
||||
end
|
||||
|
||||
it "fails poll with blank answer" do
|
||||
|
|
@ -377,7 +377,7 @@ describe Api::V1::PostsController do
|
|||
}
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.posts.failed_create"))
|
||||
confirm_api_error(response, 422, "Failed to create the post")
|
||||
end
|
||||
|
||||
it "fails poll with blank question and message text" do
|
||||
|
|
@ -393,7 +393,7 @@ describe Api::V1::PostsController do
|
|||
}
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.posts.failed_create"))
|
||||
confirm_api_error(response, 422, "Failed to create the post")
|
||||
end
|
||||
|
||||
it "creates with location" do
|
||||
|
|
@ -469,7 +469,7 @@ describe Api::V1::PostsController do
|
|||
public: true
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.posts.failed_create"))
|
||||
confirm_api_error(response, 422, "Failed to create the post")
|
||||
end
|
||||
|
||||
it "fails when no public field and no aspects" do
|
||||
|
|
@ -481,7 +481,7 @@ describe Api::V1::PostsController do
|
|||
body: message_text
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.posts.failed_create"))
|
||||
confirm_api_error(response, 422, "Failed to create the post")
|
||||
end
|
||||
|
||||
it "fails when private no aspects" do
|
||||
|
|
@ -494,7 +494,7 @@ describe Api::V1::PostsController do
|
|||
public: false
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.posts.failed_create"))
|
||||
confirm_api_error(response, 422, "Failed to create the post")
|
||||
end
|
||||
|
||||
it "fails when unknown aspect IDs" do
|
||||
|
|
@ -508,7 +508,7 @@ describe Api::V1::PostsController do
|
|||
aspects: ["-1"]
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.posts.failed_create"))
|
||||
confirm_api_error(response, 422, "Failed to create the post")
|
||||
end
|
||||
|
||||
it "fails when no public field but aspects" do
|
||||
|
|
@ -523,7 +523,7 @@ describe Api::V1::PostsController do
|
|||
aspects: [aspect.id]
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.posts.failed_create"))
|
||||
confirm_api_error(response, 422, "Failed to create the post")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -626,7 +626,7 @@ describe Api::V1::PostsController do
|
|||
api_v1_post_path("999_999_999"),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -643,7 +643,7 @@ describe Api::V1::PostsController do
|
|||
api_v1_post_path(status.guid),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 403, I18n.t("api.endpoint_errors.posts.failed_delete"))
|
||||
confirm_api_error(response, 403, "Not allowed to delete the post")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ describe Api::V1::ResharesController do
|
|||
params: {access_token: access_token}
|
||||
)
|
||||
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
|
||||
it "fails with private post it shouldn't see" do
|
||||
|
|
@ -96,7 +96,7 @@ describe Api::V1::ResharesController do
|
|||
access_token: access_token
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ describe Api::V1::ResharesController do
|
|||
params: {access_token: access_token}
|
||||
)
|
||||
|
||||
confirm_api_error(response, 409, I18n.t("reshares.create.error"))
|
||||
confirm_api_error(response, 409, "Reshare already exists")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -148,7 +148,7 @@ describe Api::V1::ResharesController do
|
|||
params: {access_token: access_token}
|
||||
)
|
||||
|
||||
confirm_api_error(response, 422, I18n.t("reshares.create.error"))
|
||||
confirm_api_error(response, 422, "Failed to reshare")
|
||||
end
|
||||
|
||||
it "fails with own post" do
|
||||
|
|
@ -157,7 +157,7 @@ describe Api::V1::ResharesController do
|
|||
params: {access_token: access_token}
|
||||
)
|
||||
|
||||
confirm_api_error(response, 422, I18n.t("reshares.create.error"))
|
||||
confirm_api_error(response, 422, "Failed to reshare")
|
||||
end
|
||||
|
||||
it "fails with private post it shouldn't see" do
|
||||
|
|
@ -168,7 +168,7 @@ describe Api::V1::ResharesController do
|
|||
access_token: access_token
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("reshares.create.error"))
|
||||
confirm_api_error(response, 422, "Failed to reshare")
|
||||
end
|
||||
|
||||
it "fails with private post it can see" do
|
||||
|
|
@ -179,7 +179,7 @@ describe Api::V1::ResharesController do
|
|||
access_token: access_token
|
||||
}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.posts.post_not_found"))
|
||||
confirm_api_error(response, 404, "Post with provided guid could not be found")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ describe Api::V1::SearchController do
|
|||
"/api/v1/search/users",
|
||||
params: {tag: "tag1", name_or_handle: "name", access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.search.cant_process"))
|
||||
confirm_api_error(response, 422, "Search request could not be processed")
|
||||
end
|
||||
|
||||
it "fails with no fields" do
|
||||
|
|
@ -136,7 +136,7 @@ describe Api::V1::SearchController do
|
|||
"/api/v1/search/users",
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.search.cant_process"))
|
||||
confirm_api_error(response, 422, "Search request could not be processed")
|
||||
end
|
||||
|
||||
it "fails with bad credentials" do
|
||||
|
|
@ -208,7 +208,7 @@ describe Api::V1::SearchController do
|
|||
"/api/v1/search/posts",
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.search.cant_process"))
|
||||
confirm_api_error(response, 422, "Search request could not be processed")
|
||||
end
|
||||
|
||||
it "fails with bad credentials" do
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ describe Api::V1::TagFollowingsController do
|
|||
params: {access_token: access_token}
|
||||
)
|
||||
|
||||
confirm_api_error(response, 422, I18n.t("api.endpoint_errors.tags.cant_process"))
|
||||
confirm_api_error(response, 422, "Failed to process the tag followings request")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ describe Api::V1::TagFollowingsController do
|
|||
params: {name: "tag3", access_token: access_token}
|
||||
)
|
||||
|
||||
confirm_api_error(response, 409, I18n.t("api.endpoint_errors.tags.cant_process"))
|
||||
confirm_api_error(response, 409, "Already following this tag")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -150,7 +150,7 @@ describe Api::V1::TagFollowingsController do
|
|||
api_v1_tag_following_path(SecureRandom.uuid.to_s),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 410, I18n.t("api.endpoint_errors.tags.cant_process"))
|
||||
confirm_api_error(response, 410, "Not following this tag")
|
||||
|
||||
get(
|
||||
api_v1_tag_followings_path,
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ describe Api::V1::UsersController do
|
|||
"/api/v1/users/999_999_999",
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.users.not_found"))
|
||||
confirm_api_error(response, 404, "User not found")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -334,7 +334,7 @@ describe Api::V1::UsersController do
|
|||
api_v1_user_contacts_path("999_999_999"),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.users.not_found"))
|
||||
confirm_api_error(response, 404, "User not found")
|
||||
end
|
||||
|
||||
it "fails with other user's GUID" do
|
||||
|
|
@ -342,7 +342,7 @@ describe Api::V1::UsersController do
|
|||
api_v1_user_contacts_path(alice.guid),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.users.not_found"))
|
||||
confirm_api_error(response, 404, "User not found")
|
||||
end
|
||||
|
||||
it "fails if insufficient scope token" do
|
||||
|
|
@ -424,7 +424,7 @@ describe Api::V1::UsersController do
|
|||
api_v1_user_photos_path("999_999_999"),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.users.not_found"))
|
||||
confirm_api_error(response, 404, "User not found")
|
||||
end
|
||||
|
||||
it "fails if invalid token" do
|
||||
|
|
@ -497,7 +497,7 @@ describe Api::V1::UsersController do
|
|||
api_v1_user_posts_path("999_999_999"),
|
||||
params: {access_token: access_token}
|
||||
)
|
||||
confirm_api_error(response, 404, I18n.t("api.endpoint_errors.users.not_found"))
|
||||
confirm_api_error(response, 404, "User not found")
|
||||
end
|
||||
|
||||
it "fails if invalid token" do
|
||||
|
|
|
|||
Loading…
Reference in a new issue