Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cleaning-portalmec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Richard Fernando Heise Ferreira
cleaning-portalmec
Commits
2a1a0078
Commit
2a1a0078
authored
8 years ago
by
Bruno FS
Browse files
Options
Downloads
Patches
Plain Diff
Added collection update auth test
parent
6969f0db
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/controllers/v1/collections_controller_test.rb
+34
-16
34 additions, 16 deletions
test/controllers/v1/collections_controller_test.rb
with
34 additions
and
16 deletions
test/controllers/v1/collections_controller_test.rb
+
34
−
16
View file @
2a1a0078
...
...
@@ -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
cre
ate and return :
creat
ed code'
do
auth_request
users
(
:j
ack
)
post
:
cre
ate
,
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
upd
ate and return :
unauthoriz
ed code'
do
auth_request
users
(
:j
ohn
)
post
:
upd
ate
,
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment