Commit 99ece19bd5eb70e16c0240d45249839cfd4c7ed9

Authored by Gabriela Navarro
1 parent 31d8c781
Exists in master and in 79 other branches add_sisp_to_chef, add_super_archives_plugin, api_for_colab, automates_core_packing, backup_not_prod, changes_in_buttons_on_content_panel, colab_automated_login, colab_spb_plugin_recipe, colab_widgets_settings, design_validation, dev_env_minimal, disable_email_dev, fix_breadcrumbs_position, fix_categories_software_link, fix_edit_institution, fix_edit_software_with_another_license, fix_get_license_info, fix_gitlab_assets_permission, fix_list_style_inside_article, fix_list_style_on_folder_elements, fix_members_pagination, fix_merge_request_url, fix_models_translations, fix_no_license, fix_software_api, fix_software_block_migration, fix_software_communities_translations, fix_software_communities_unit_test, fix_style_create_institution_admin_panel, fix_superarchives_imports, fix_sym_links_noosfero, focus_search_field_theme, gov-user-refactoring, gov-user-refactoring-rails4, header_fix, institution_modal_on_rating, kalibro-conf-refactoring, kalibro-processor-package, lxc_settings, margin_fix, mezuro_cookbook, prezento, refactor_download_block, refactor_software_communities, refactor_software_for_sisp, register_page, release-process, release-process-v2, remove-unused-images, remove_broken_theme, remove_secondary_email_from_user, remove_sisp_buttons, removing_super_archives_email, review_message, scope2method, signals_user_noosfero, sisp_catalog_header, sisp_colab_config, sisp_dev, sisp_dev_master, sisp_simple_version, software_as_organization, software_catalog_style_fix, software_communities_html_refactor, software_infos_api, spb_minimal_env, spb_to_rails4, spec_refactor, stable-4.1, stable-4.2, stable-4.x, temp_soft_comm_refactoring, theme_header, theme_javascript_refactory, thread_dropdown, thread_page, update_search_by_categories, update_software_api, update_softwares_boxes

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>
test/functional/account_controller_test.rb
... ... @@ -45,7 +45,6 @@ class AccountControllerTest &lt; ActionController::TestCase
45 45  
46 46 @second_profile_data_info = {
47 47 :name=>"Um outro usuario",
48   - :area_interest=>"uma area ai"
49 48 }
50 49 disable_signup_bot_check
51 50 end
... ... @@ -129,7 +128,8 @@ class AccountControllerTest &lt; ActionController::TestCase
129 128  
130 129 post :signup, :user => @user_info, :profile_data => @profile_data_info
131 130 assert !assigns(:user).save, "This should not have been saved."
132   -
  131 + end
  132 +
133 133 should "user can register without secondary_email" do
134 134 @user_info[:secondary_email] = ""
135 135  
... ...
test/functional/mpog_software_plugin_myprofile_controller_test.rb
... ... @@ -65,9 +65,8 @@ class MpogSoftwarePluginMyprofileControllerTest &lt; ActionController::TestCase
65 65 fields = software_fields
66 66 post :new_software, :profile => person.identifier, :community => fields[6], :license_info => fields[5],
67 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 70 end
72 71  
73 72  
... ...
test/functional/software_test_helper.rb
... ... @@ -52,6 +52,16 @@ module SoftwareTestHelper
52 52 license_info
53 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 65 def create_software fields
56 66  
57 67 software = SoftwareInfo.new
... ... @@ -63,6 +73,7 @@ module SoftwareTestHelper
63 73 operating_system_hash = fields[4]
64 74 license_system_hash = fields[5]
65 75 community_hash = fields[6]
  76 + categories_hash = fields[7]
66 77  
67 78 software_hash.each do |k,v|
68 79 software[k] = v
... ... @@ -79,6 +90,7 @@ module SoftwareTestHelper
79 90 software.operating_systems << create_operating_system(operating_system_hash)
80 91 software.license_info_id = license_system_hash
81 92 software.libraries << create_library(library_hash)
  93 + software.software_categories = create_categories(categories_hash)
82 94  
83 95 software
84 96 end
... ... @@ -132,6 +144,30 @@ module SoftwareTestHelper
132 144 fields['operating_platform'] = 'operating_plataform_test'
133 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 171 hash_list = []
136 172 hash_list << fields
137 173 hash_list << list_library
... ... @@ -140,6 +176,7 @@ module SoftwareTestHelper
140 176 hash_list << list_operating_system
141 177 hash_list << fields_license
142 178 hash_list << fields_community
  179 + hash_list << fields_categories
143 180 hash_list
144 181 end
145   -end
146 182 \ No newline at end of file
  183 +end
... ...