Commit 262de429fd9a9709f72c8ddce99eb92dd471b4aa
1 parent
30157668
Exists in
master
and in
22 other branches
Add api test to get only visible softwares
Signed-off-by: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com>
Showing
1 changed file
with
13 additions
and
0 deletions
Show diff stats
src/noosfero-spb/software_communities/test/unit/api_test.rb
... | ... | @@ -28,4 +28,17 @@ class SoftwareCommunitiesApiTest < ActiveSupport::TestCase |
28 | 28 | assert_equal @software_info.id, json["software_info"]["id"] |
29 | 29 | end |
30 | 30 | |
31 | + should 'list only softwares with visible community' do | |
32 | + @software_info = create_software_info("software_test") | |
33 | + @software_info2 = create_software_info("software_test2") | |
34 | + | |
35 | + @software_info2.community.visible = false | |
36 | + @software_info2.community.save! | |
37 | + | |
38 | + get "/api/v1/software_communities?#{params.to_query}" | |
39 | + json = JSON.parse(last_response.body) | |
40 | + | |
41 | + assert_includes json['software_infos'].map{|c| c['id']}, @software_info.id | |
42 | + assert_not_includes json['software_infos'].map{|c| c['id']}, @software_info2.id | |
43 | + end | |
31 | 44 | end | ... | ... |