test/unit/kaui/admin_tenant_test.rb in kaui-2.0.0 vs test/unit/kaui/admin_tenant_test.rb in kaui-2.0.1

- old
+ new

@@ -60,60 +60,25 @@ string = 'this-IsA string_to-split' splitted = adminTenantController.send(:split_camel_dash_underscore_space, string) assert_split(splitted) end - test 'can do a fuzzy match of a plugin to suggest a plugin' do - plugins_info = plugins_repo - adminTenantController = Kaui::AdminTenantsController.new - - %w(killbill-paypal express paypal pay).each do |plugin_name| - found_plugin, weights = adminTenantController.send(:fuzzy_match, plugin_name, plugins_info) - assert_nil(found_plugin) - assert_equal weights[0][:plugin_name], 'killbill-paypal-express' - end - - plugin_name = 'email' - found_plugin, weights = adminTenantController.send(:fuzzy_match, plugin_name, plugins_info) - assert_nil(found_plugin) - assert_equal weights[0][:plugin_name], 'killbill-email-notifications' - - %w(first firstdata firstdata_e4).each do |plugin_name| - found_plugin, weights = adminTenantController.send(:fuzzy_match, plugin_name, plugins_info) - assert_nil(found_plugin) - assert_equal weights[0][:plugin_name], 'killbill-firstdata-e4' - end - - %w(braintree brain).each do |plugin_name| - found_plugin, weights = adminTenantController.send(:fuzzy_match, plugin_name, plugins_info) - assert_nil(found_plugin) - assert_equal weights[0][:plugin_name], 'killbill-braintree_blue' - end - - # if found weights should be empty - plugin_name = 'avatax' - found_plugin, weights = adminTenantController.send(:fuzzy_match, plugin_name, plugins_info) - assert_equal weights.size, 0 - assert_equal found_plugin[:plugin_name], 'killbill-avatax' - end - test 'should fetch proprietary plugin config' do tenant = create_tenant() assert_not_nil(tenant) options = build_options(tenant) # upload plugin configuration plugin_name = 'duck-plugin' plugin_config = 'key=value' Kaui::AdminTenant.upload_tenant_plugin_config(plugin_name, plugin_config, options[:username], nil, nil, options) - plugins_config = Kaui::AdminTenant.get_tenant_plugin_config({}, options) + plugins_config = Kaui::AdminTenant.get_tenant_plugin_config(options) assert_not_nil(plugins_config) - plugin_info = plugins_config.split('::') - assert_equal plugin_name, plugin_info[0] - assert_equal 'key=value|_raw=key=value', plugin_info[1].gsub('raw_config=','') + assert_equal plugin_name, plugins_config.keys.first + assert_equal 'key=value', plugins_config[plugin_name] end test 'should fetch plugin config' do tenant = create_tenant() assert_not_nil(tenant) @@ -128,19 +93,17 @@ } plugin_config = Kaui::AdminTenant.format_plugin_config(plugin_key, 'ruby', plugin_properties) Kaui::AdminTenant.upload_tenant_plugin_config(plugin_name, plugin_config, options[:username], nil, nil, options) - plugins_config = Kaui::AdminTenant.get_tenant_plugin_config({ :paypal_express => { 'type' => 'ruby', - 'artifact_id' => 'paypal-express-plugin'} }, options) + plugins_config = Kaui::AdminTenant.get_tenant_plugin_config(options) assert_not_nil(plugins_config) - plugin_info = plugins_config.split('::') - assert_equal plugin_key, plugin_info[0] - response_plugin_properties = plugin_info[1].split('|') - assert_equal plugin_properties[:signature], response_plugin_properties[0].split('=')[1] - assert_equal plugin_properties[:login], response_plugin_properties[1].split('=')[1] - assert_equal plugin_properties[:password], response_plugin_properties[2].split('=')[1] + assert_equal plugin_name, plugins_config.keys.first + response_plugin_properties = plugins_config[plugin_name].split + assert_equal plugin_properties[:signature], response_plugin_properties[3] + assert_equal plugin_properties[:login], response_plugin_properties[5] + assert_equal plugin_properties[:password], response_plugin_properties[7] end private def plugins_repo @@ -164,6 +127,6 @@ assert_equal 'a', splitted[2] assert_equal 'string', splitted[3] assert_equal 'to', splitted[4] assert_equal 'split', splitted[5] end -end \ No newline at end of file +end