Commit 9eb2ca425c667fd572624bac9fd939142d2213c1
1 parent
548bab10
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
HOTFIX API: expose children count attribute
Showing
2 changed files
with
12 additions
and
0 deletions
Show diff stats
lib/noosfero/api/entities.rb
test/unit/api/articles_test.rb
... | ... | @@ -91,6 +91,17 @@ class ArticlesTest < ActiveSupport::TestCase |
91 | 91 | assert_not_includes json['articles'].map {|a| a['id']}, child.id |
92 | 92 | end |
93 | 93 | |
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 | + | |
96 | + expose_attributes.each do |attr| | |
97 | + should "expose article #{attr} attribute" do | |
98 | + article = fast_create(Article, :profile_id => user.person.id, :name => "Some thing") | |
99 | + get "/api/v1/articles/?#{params.to_query}" | |
100 | + json = JSON.parse(last_response.body) | |
101 | + assert json["articles"].last.has_key?(attr) | |
102 | + end | |
103 | + end | |
104 | + | |
94 | 105 | ############################# |
95 | 106 | # Profile Articles # |
96 | 107 | ############################# | ... | ... |