Commit 7649012edcce40aba298c2dbc6a7a78867954332
1 parent
9eb2ca42
Exists in
staging
and in
4 other branches
HOTFIX API: expose display_color for category
Showing
3 changed files
with
13 additions
and
1 deletions
Show diff stats
lib/noosfero/api/entities.rb
test/unit/api/articles_test.rb
... | ... | @@ -94,7 +94,7 @@ class ArticlesTest < ActiveSupport::TestCase |
94 | 94 | expose_attributes = %w(id body abstract created_at title author profile categories image votes_for votes_against setting position hits start_date end_date tag_list parent children children_count) |
95 | 95 | |
96 | 96 | expose_attributes.each do |attr| |
97 | - should "expose article #{attr} attribute" do | |
97 | + should "expose article #{attr} attribute by default" do | |
98 | 98 | article = fast_create(Article, :profile_id => user.person.id, :name => "Some thing") |
99 | 99 | get "/api/v1/articles/?#{params.to_query}" |
100 | 100 | json = JSON.parse(last_response.body) | ... | ... |
test/unit/api/categories_test.rb
... | ... | @@ -83,4 +83,15 @@ class CategoriesTest < ActiveSupport::TestCase |
83 | 83 | json["categories"].map{ |c| c['children'].map{ |child| child['id'] }.sort } |
84 | 84 | end |
85 | 85 | |
86 | + expose_attributes = %w(id name full_name image display_color) | |
87 | + | |
88 | + expose_attributes.each do |attr| | |
89 | + should "expose category #{attr} attribute by default" do | |
90 | + category = fast_create(Category, :environment_id => environment.id) | |
91 | + get "/api/v1/categories/?#{params.to_query}" | |
92 | + json = JSON.parse(last_response.body) | |
93 | + assert json["categories"].last.has_key?(attr) | |
94 | + end | |
95 | + end | |
96 | + | |
86 | 97 | end | ... | ... |