Skip to content
Snippets Groups Projects
Commit ee9451ea authored by Mateus Rambo Strey's avatar Mateus Rambo Strey
Browse files

Merge branch 'collection_patch_test' into 'master'

Added collection update test

See merge request !317
parents 0a8ffefb 146b61b8
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,42 @@ class V1::CollectionsControllerTest < ActionController::TestCase
assert_response :unauthorized
end
test 'should user patch collection to update and return :ok 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 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 :unauthorized
end
test 'should user add items to collection and return :ok code' do
auth_request users(:john)
post :add_object, params: { id: collections(:ufpr).id, collection: {items: [{id: learning_objects(:lo_metadata2).id, type: 'LearningObject'}] }}
......@@ -67,7 +103,6 @@ class V1::CollectionsControllerTest < ActionController::TestCase
assert_response :unprocessable_entity
end
test 'should user tagging a collection' do
auth_request users(:jack)
tag = tags(:tag_three).name
......
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