Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • portalmec/portalmec
  • rfhferreira/cleanning-portalmec
2 results
Show changes
Showing
with 0 additions and 505 deletions
require 'test_helper'
class V1::UsersControllerTest < ActionController::TestCase
tests V1::UsersController
include Devise::Test::ControllerHelpers
test 'should get index' do
skip('Unsolved issue: ArgumentError: wrong number of arguments (2 for 0)')
end
test 'should post user to create and return :created code' do
auth_request users(:jack)
post :create, params: { user: { name: 'mauricio',
email: 'testando@inf.ufpr.br',
password: 'test123455',
password_confirmation: 'test123455',
terms_of_service: '1' } }
assert_response :created
end
test 'should post invalid user to create and return :unprocessable_entity code' do
auth_request users(:jack)
post :create, params: { user: { name: 'mauricio', email: '', password: 'test123455', password_confirmation: 'test123455',
terms_of_service: false, role_ids: [] } }
assert_response :unprocessable_entity
end
test 'should put user to update and return :ok code' do
auth_request users(:jack)
user = users(:john)
put :update, params: { user: { name: 'mauricio',
email: 'testando@inf.ufpr.br',
password: 'test123455',
password_confirmation: 'test123455',
terms_of_service: '1'
}, id: user.id }
assert_response :ok
end
test 'should put invalid user to update and return :unprocessable_entity code' do
auth_request users(:jack)
user = users(:john)
put :update, params: { user: { name: 'mauricio', email: '', password: 'test123455', password_confirmation: 'test123455',
terms_of_service: false }, id: user.id }
assert_response :unprocessable_entity
end
test 'should delete an user and return :ok code' do
auth_request users(:jack)
user = users(:john)
delete :destroy, params: { id: user.id }
assert_response :ok
end
test 'should not current user delete yourself' do
auth_request users(:john)
user = users(:john)
delete :destroy, params: { id: user.id }
assert_response :forbidden
end
test 'should user follow an user jack' do
auth_request users(:john)
post :follow, params: { id: users(:jack).id }
assert_response :created
end
test 'should user follow an already followed user and return :forbidden code' do
auth_request users(:john)
post :follow, params: { id: users(:jack).id }
assert_response :created
post :follow, params: { id: users(:jack).id }
assert_response :forbidden
end
test 'should user unfollow an user jack' do
auth_request users(:john)
post :follow, params: { id: users(:jack).id }
assert_response :created
delete :unfollow, params: { id: users(:jack).id }
assert_response :ok
end
end
test_app:
name: 'test app'
domain: 'test.host'
application_id: 'ffcb31a0-bacc-4f37-925c-656b3805095a'
user_id: john (User)
\ No newline at end of file
ufpr:
name: 'UFPR collection'
owner: john (User)
privacy: 'public'
\ No newline at end of file
reason_1:
reason: 'inapropriado'
ufpr:
name: 'UFPR institution'
address: 'politecnico'
city: 'curitiba'
country: 'brasil'
\ No newline at end of file
portuguese:
name: 'Português'
code: 'pt_BR'
\ No newline at end of file
# == Schema Information
#
# Table name: learning_objects
#
# id :integer not null, primary key
# id_dspace :integer
# name :string
# author :string
# description :text
# published_at :datetime
# score :float default("0.0")
# school_level :integer
# metadata :jsonb default("{}")
# keywords :text
# publisher_id :integer
# publisher_type :string
# language_id :integer
# object_type_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# views_count :integer default("0")
# downloads_count :integer default("0")
# likes_count :integer default("0")
# shares_count :integer default("0")
# state :string default("published")
# thumbnail_file_name :string
# thumbnail_content_type :string
# thumbnail_file_size :integer
# thumbnail_updated_at :datetime
# attachment_id :integer
#
one:
name: 'Object 1'
description: 'Testing'
user_lo:
name: 'Object 1'
description: 'Testing'
author: 'Mauricio'
publisher: john (User)
institution_lo:
name: 'Institution Object 1'
description: 'Testing'
author: 'Mauricio'
publisher: ufpr (Institution)
lo_complete:
name: 'Institution Object 1'
description: 'Testing'
author: 'Mauricio'
id_dspace: '1'
object_type: image
language: portuguese
lo_metadata:
name: 'Institution Object 1'
description: 'Testing'
author: 'Mauricio'
id_dspace: '2'
object_type: image
language: portuguese
metadata: '{"dc.creator": "ufpr"}'
lo_metadata2:
name: 'Institution Object 2'
description: 'Testing'
author: 'Mauricio'
id_dspace: '3'
object_type: image
language: portuguese
metadata: '{"dc.creator": "ufpr"}'
search:
name: 'Teste'
description: 'Testing'
author: 'Israel'
publisher: ufpr (Institution)
object_type: image
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
description: MyText
url: MyString
image_url: MyString
two:
name: MyString
description: MyText
url: MyString
image_url: MyString
jpg:
extension: '.jpg'
mime_type: 'image/jpg'
mp4:
extension: '.mp4'
mime_type: 'video/mp4'
image:
name: 'Imagem'
mime_types: jpg (MimeType)
usability:
name: 'usability'
application_context:
name: 'application context'
content:
name: 'content quality'
\ No newline at end of file
one_collection_review_rating:
review: collection (Review)
rating: usability (Rating)
value: 5
two_collection_review_rating:
review: collection (Review)
rating: application_context (Rating)
value: 5
three_collection_review_rating:
review: collection (Review)
rating: content (Rating)
value: 5
one_lo_review_rating:
review: learning_object (Review)
rating: usability (Rating)
value: 2
two_lo_review_rating:
review: learning_object (Review)
rating: application_context (Rating)
value: 3
three_lo_review_rating:
review: learning_object (Review)
rating: content (Rating)
value: 4
\ No newline at end of file
collection:
name: 'my collection review'
description: 'testing a review about collection'
pros: 'my pros'
cons: 'my cons'
reviewable: ufpr (Collection)
user: admin (User)
learning_object:
name: 'my learning object review'
description: 'testing a review about learning object'
pros: 'my pros'
cons: 'my cons'
reviewable: user_lo (LearningObject)
user: admin (User)
\ No newline at end of file
teacher:
name: 'teacher'
admin:
name: 'admin'
# == Schema Information
#
# Table name: score_user_categories
#
# id :integer not null, primary key
# score_id :integer
# user_category_id :integer
# value :float
# created_at :datetime not null
# updated_at :datetime not null
#
<%
values = [
[ 0, 0, 0, 0, 0, 0, 0, 0, 0], # Iniciante
[ 25, 3.0, 10, 500, 250, 70, 50, 5, 400], # Novato
[ 50, 3.8, 20, 550, 350, 85, 250, 15, 600], # Amador
[ 100, 4.2, 40, 600, 450, 90, 1000, 25, 750], # Profissional
[ 250, 4.9, 80, 680, 550, 95, 5000, 35, 800] # Expert
]
%>
<% 1.upto(values.first.size) do |i| %>
<% 1.upto(values.size) do |j| %>
<%= i %>_<%= j %>:
score: <%= i %>
user_category: <%= j %>
value: <%= values[j-1][i-1] %>
<% end %>
<% end %>
# == Schema Information
#
# Table name: scores
#
# id :integer not null, primary key
# name :string
# code :string
# weight :float
# active :boolean default("true")
# created_at :datetime not null
# updated_at :datetime not null
# score_type :string default("{}"), is an Array
#
1:
name: 'Quantidade de envio de objetos'
code: 'submitted_objects'
weight: 4
active: true
score_type: ['User']
2:
name: 'Avaliação média dos seus objetos'
code: 'reviews_score_average'
weight: 9
active: true
score_type: ['User']
3:
name: 'Adições a coleções bem avaliadas'
code: 'learning_objects_in_best_collections'
weight: 7
active: true
score_type: ['User']
4:
name: 'Melhor score'
code: 'learning_objects_best_score'
weight: 3
active: true
score_type: ['User']
5:
name: 'Score médio'
code: 'learning_objects_average_score'
weight: 7
active: true
score_type: ['User']
6:
name: 'Aprovação das avaliações em objetos de terceiros (% de sim)'
code: 'review_approval_average'
weight: 10
active: true
score_type: ['User']
# reputation_confirmed_complaints:
# name: 'Denúncias confirmadas'
# code: 'reputation_confirmed_complaints'
# weight: 0
# active: true
# score_type: ['User']
7:
name: 'Quantidade de seguidores'
code: 'followers_count'
weight: 6
active: true
score_type: ['User']
8:
name: 'Submissões recentes'
code: 'learning_objects_recently_submitted'
weight: 4
active: true
score_type: ['User']
9:
name: 'Score das coleções públicas'
code: 'collections_score_average'
weight: 3
active: true
score_type: ['User']
10:
name: 'Média das avaliações'
code: 'normalized_review_average'
weight: 10
active: true
score_type: ['LearningObject', 'Collection']
11:
name: 'Thumbnail'
code: 'normalized_thumbnail'
weight: 3
active: true
score_type: ['LearningObject', 'Collection']
12:
name: 'Quantidade de visualizações'
code: 'normalized_views'
weight: 3
active: true
score_type: ['LearningObject', 'Collection']
13:
name: 'Quantidade de likes'
code: 'normalized_likes'
weight: 3
active: true
score_type: ['LearningObject', 'Collection']
14:
name: 'Quantidade de downloads'
code: 'normalized_downloads'
weight: 3
active: true
score_type: ['LearningObject', 'Collection']
15:
name: 'Quantidade de compartilhamento'
code: 'normalized_shares'
weight: 2
active: true
score_type: ['LearningObject', 'Collection']
16:
name: 'Descrição'
code: 'normalized_description'
weight: 2
active: true
score_type: ['LearningObject', 'Collection']
17:
name: 'Categoria do usuário criador'
code: 'user_category'
weight: 7
active: true
score_type: ['LearningObject', 'Collection']
18:
name: 'Adições à coleções'
code: 'normalized_collected'
weight: 4
active: true
score_type: ['LearningObject', 'Collection']
score_19:
name: 'Adições à favoritos'
code: 'normalized_bookmarked'
weight: 6
active: true
score_type: ['LearningObject', 'Collection']
\ No newline at end of file
tagging_one:
tag: tag_one
tagger: john (User)
taggable: ufpr (Collection)
tagging_two:
tag: tag_one
tagger: jack (User)
taggable: one (LearningObject)
tagging_three:
tag: tag_two
tagger: ufpr (Institution)
taggable: ufpr (Collection)
tagging_four:
tag: tag_two
tagger: ufpr (Institution)
taggable: search (LearningObject)
\ No newline at end of file
tag_one:
name: 'Português'
tag_two:
name: 'Matemática'
tag_three:
name: 'Biologia'
\ No newline at end of file
# == Schema Information
#
# Table name: user_categories
#
# id :integer not null, primary key
# name :string
# reference :float
# created_at :datetime not null
# updated_at :datetime not null
#
1:
name: 'Iniciante'
reference: 0.0
2:
name: 'Novato'
reference: 0.408919891329286
3:
name: 'Amador'
reference: 0.558910604053845
4:
name: 'Profissional'
reference: 0.708149893070887
5:
name: 'Expert'
reference: 1.0