Skip to content
Snippets Groups Projects
Commit 2a1a0078 authored by Bruno FS's avatar Bruno FS
Browse files

Added collection update auth test

parent 6969f0db
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,24 @@ class V1::CollectionsControllerTest < ActionController::TestCase
assert_response :created
end
test 'should institution post collection to create and return :created code' do
auth_request users(:jack)
post :create, params: { collection: { name: 'my collection',
description: 'testing collection',
owner_type: 'Institution', owner_id: institutions(:ufpr).id,
items: [{id: learning_objects(:user_lo).id, type: "LearningObject"}]}
}
assert_response :created
end
test 'should user post collection to create and return :unauthorized code' do
post :create, params: { collection: {name: 'my collection',
description: 'testing collection',
owner_type: 'Institution', owner_id: institutions(:ufpr).id }
}
assert_response :unauthorized
end
test 'should user patch collection to update and return :ok code' do
auth_request users(:john)
post :update, params: {
......@@ -36,22 +54,22 @@ class V1::CollectionsControllerTest < ActionController::TestCase
assert_response :ok
end
test 'should institution post collection to create and return :created code' do
auth_request users(:jack)
post :create, params: { collection: { name: 'my collection',
description: 'testing collection',
owner_type: 'Institution', owner_id: institutions(:ufpr).id,
items: [{id: learning_objects(:user_lo).id, type: "LearningObject"}]}
}
assert_response :created
end
test 'should user post collection to create and return :unauthorized code' do
post :create, params: { collection: {name: 'my collection',
description: 'testing collection',
owner_type: 'Institution', owner_id: institutions(:ufpr).id }
}
assert_response :unauthorized
test 'should user patch collection to update and return :unauthorized code' do
auth_request users(:john)
post :update, params: {
id: collections(:ufpr).id,
collection: {
name: 'my updated collection',
description: 'testing to update collection',
owner_type: 'User', owner_id: users(:john).id,
items:
[
{id: learning_objects(:one).id, type: "LearningObject", order: 1},
{id: collections(:ufpr).id, type: "Collection", order: 3}
]
}
}
assert_response :ok
end
test 'should user tagging a collection' do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment