Commit 99ece19bd5eb70e16c0240d45249839cfd4c7ed9
1 parent
31d8c781
Exists in
master
and in
5 other branches
Fix functionals tests for new software
Signed-off-by: David Carlos <ddavidcarlos1392@gmail.com> Signed-off-by: Gabriela Navarro <navarro1703@gmail.com> Signed-off-by: Gustavo Jaruga <darksshades@gmail.com> Signed-off-by: Luiz Matos <luizff.matos@gmail.com>
Showing
3 changed files
with
42 additions
and
6 deletions
Show diff stats
test/functional/account_controller_test.rb
@@ -45,7 +45,6 @@ class AccountControllerTest < ActionController::TestCase | @@ -45,7 +45,6 @@ class AccountControllerTest < ActionController::TestCase | ||
45 | 45 | ||
46 | @second_profile_data_info = { | 46 | @second_profile_data_info = { |
47 | :name=>"Um outro usuario", | 47 | :name=>"Um outro usuario", |
48 | - :area_interest=>"uma area ai" | ||
49 | } | 48 | } |
50 | disable_signup_bot_check | 49 | disable_signup_bot_check |
51 | end | 50 | end |
@@ -129,7 +128,8 @@ class AccountControllerTest < ActionController::TestCase | @@ -129,7 +128,8 @@ class AccountControllerTest < ActionController::TestCase | ||
129 | 128 | ||
130 | post :signup, :user => @user_info, :profile_data => @profile_data_info | 129 | post :signup, :user => @user_info, :profile_data => @profile_data_info |
131 | assert !assigns(:user).save, "This should not have been saved." | 130 | assert !assigns(:user).save, "This should not have been saved." |
132 | - | 131 | + end |
132 | + | ||
133 | should "user can register without secondary_email" do | 133 | should "user can register without secondary_email" do |
134 | @user_info[:secondary_email] = "" | 134 | @user_info[:secondary_email] = "" |
135 | 135 |
test/functional/mpog_software_plugin_myprofile_controller_test.rb
@@ -65,9 +65,8 @@ class MpogSoftwarePluginMyprofileControllerTest < ActionController::TestCase | @@ -65,9 +65,8 @@ class MpogSoftwarePluginMyprofileControllerTest < ActionController::TestCase | ||
65 | fields = software_fields | 65 | fields = software_fields |
66 | post :new_software, :profile => person.identifier, :community => fields[6], :license_info => fields[5], | 66 | post :new_software, :profile => person.identifier, :community => fields[6], :license_info => fields[5], |
67 | :software_info => fields[0], :library => fields[1], :database => fields[3], | 67 | :software_info => fields[0], :library => fields[1], :database => fields[3], |
68 | - :language => fields[2], :operating_system=> fields[4] | ||
69 | - | ||
70 | - assert_equal SoftwareInfo.last.name, "Debian" | 68 | + :language => fields[2], :operating_system=> fields[4],:software_categories => fields[7] |
69 | + assert_equal SoftwareInfo.last.community.name, "Debian" | ||
71 | end | 70 | end |
72 | 71 | ||
73 | 72 |
test/functional/software_test_helper.rb
@@ -52,6 +52,16 @@ module SoftwareTestHelper | @@ -52,6 +52,16 @@ module SoftwareTestHelper | ||
52 | license_info | 52 | license_info |
53 | end | 53 | end |
54 | 54 | ||
55 | + def create_categories categories_hash | ||
56 | + software_categories = SoftwareCategories.new | ||
57 | + | ||
58 | + categories_hash.each do |k,v| | ||
59 | + software_categories[k] = v | ||
60 | + end | ||
61 | + software_categories.save | ||
62 | + software_categories | ||
63 | + end | ||
64 | + | ||
55 | def create_software fields | 65 | def create_software fields |
56 | 66 | ||
57 | software = SoftwareInfo.new | 67 | software = SoftwareInfo.new |
@@ -63,6 +73,7 @@ module SoftwareTestHelper | @@ -63,6 +73,7 @@ module SoftwareTestHelper | ||
63 | operating_system_hash = fields[4] | 73 | operating_system_hash = fields[4] |
64 | license_system_hash = fields[5] | 74 | license_system_hash = fields[5] |
65 | community_hash = fields[6] | 75 | community_hash = fields[6] |
76 | + categories_hash = fields[7] | ||
66 | 77 | ||
67 | software_hash.each do |k,v| | 78 | software_hash.each do |k,v| |
68 | software[k] = v | 79 | software[k] = v |
@@ -79,6 +90,7 @@ module SoftwareTestHelper | @@ -79,6 +90,7 @@ module SoftwareTestHelper | ||
79 | software.operating_systems << create_operating_system(operating_system_hash) | 90 | software.operating_systems << create_operating_system(operating_system_hash) |
80 | software.license_info_id = license_system_hash | 91 | software.license_info_id = license_system_hash |
81 | software.libraries << create_library(library_hash) | 92 | software.libraries << create_library(library_hash) |
93 | + software.software_categories = create_categories(categories_hash) | ||
82 | 94 | ||
83 | software | 95 | software |
84 | end | 96 | end |
@@ -132,6 +144,30 @@ module SoftwareTestHelper | @@ -132,6 +144,30 @@ module SoftwareTestHelper | ||
132 | fields['operating_platform'] = 'operating_plataform_test' | 144 | fields['operating_platform'] = 'operating_plataform_test' |
133 | fields['demonstration_url'] = 'test' | 145 | fields['demonstration_url'] = 'test' |
134 | 146 | ||
147 | + fields_categories = {} | ||
148 | + fields_categories["administration"] = true | ||
149 | + fields_categories["agriculture"] = "1" | ||
150 | + fields_categories["business_and_services"] = "1" | ||
151 | + fields_categories["communication"] = "1" | ||
152 | + fields_categories["culture"] = "1" | ||
153 | + fields_categories["national_defense"] = "1" | ||
154 | + fields_categories["economy_and_finances"] = "1" | ||
155 | + fields_categories["education"] = "1" | ||
156 | + fields_categories["energy"] = "1" | ||
157 | + fields_categories["sports"] = "1" | ||
158 | + fields_categories["habitation"] = "1" | ||
159 | + fields_categories["industry"] = "1" | ||
160 | + fields_categories["environment"] = "1" | ||
161 | + fields_categories["research_and_development"] = "1" | ||
162 | + fields_categories["social_security"] = "1" | ||
163 | + fields_categories["social_protection"] = "1" | ||
164 | + fields_categories["sanitation"] = "1" | ||
165 | + fields_categories["health"] = "1" | ||
166 | + fields_categories["security_public_order"] = "1" | ||
167 | + fields_categories["work"] = "1" | ||
168 | + fields_categories["transportation"] = "1" | ||
169 | + fields_categories["urbanism"] = "1" | ||
170 | + | ||
135 | hash_list = [] | 171 | hash_list = [] |
136 | hash_list << fields | 172 | hash_list << fields |
137 | hash_list << list_library | 173 | hash_list << list_library |
@@ -140,6 +176,7 @@ module SoftwareTestHelper | @@ -140,6 +176,7 @@ module SoftwareTestHelper | ||
140 | hash_list << list_operating_system | 176 | hash_list << list_operating_system |
141 | hash_list << fields_license | 177 | hash_list << fields_license |
142 | hash_list << fields_community | 178 | hash_list << fields_community |
179 | + hash_list << fields_categories | ||
143 | hash_list | 180 | hash_list |
144 | end | 181 | end |
145 | -end | ||
146 | \ No newline at end of file | 182 | \ No newline at end of file |
183 | +end |