<commit_before>require 'test_helper'

class ConfigurationHelper
  
  test "Make sure that all of the Oauth identifier schemes are registered in the appropriate places" do
    
=begin
    # Devise configuration helper
    # ----------------------------------------------------
    if !Devise.nil?
      # Check to see what Omniauth providers were registered with Devise
      # Compare them to the entries in the DB and adjust the DB records accordingly
      defined = IdentifierScheme.where(active: true)#.collect{ |scheme| scheme.name }
      registered = Devise.omniauth_providers

      # Deactivate any entries that are not defined in the config/initializers/devise.rb
      defined.each do |scheme|
        unless registered.include?(scheme.name.to_sym)
          Rails.logger.info "Detected an unsupported identifier_scheme, #{scheme.name}, in the DB, deactivating the entry - if this is a mistake add it to your config/initializers/devise.rb"
          scheme.update_attributes(active: false)
        end
      end

      # If an entry was defined in config/initializers/devise.rb but is not in the DB, add it
      diff = registered.reject{ |i| defined.collect{ |d| d.name }.include?(i.to_s) }
      diff.each do |scheme|
        is = IdentifierScheme.find_by(name: scheme.to_s)<commit_msg>fixed bug in new config test<commit_after>require 'test_helper'

class ConfigurationHelper < ActionDispatch::IntegrationTest
  
  test "Make sure that all of the Oauth identifier schemes are registered in the appropriate places" do
    
=begin
    # Devise configuration helper
    # ----------------------------------------------------
    if !Devise.nil?
      # Check to see what Omniauth providers were registered with Devise
      # Compare them to the entries in the DB and adjust the DB records accordingly
      defined = IdentifierScheme.where(active: true)#.collect{ |scheme| scheme.name }
      registered = Devise.omniauth_providers

      # Deactivate any entries that are not defined in the config/initializers/devise.rb
      defined.each do |scheme|
        unless registered.include?(scheme.name.to_sym)
          Rails.logger.info "Detected an unsupported identifier_scheme, #{scheme.name}, in the DB, deactivating the entry - if this is a mistake add it to your config/initializers/devise.rb"
          scheme.update_attributes(active: false)
        end
      end

      # If an entry was defined in config/initializers/devise.rb but is not in the DB, add it
      diff = registered.reject{ |i| defined.collect{ |d| d.name }.include?(i.to_s) }
      diff.each do |scheme|
        is = IdentifierScheme.find_by(name: scheme.to_s)
{'fraction_non_alphanumeric': 0.10993577635058557, 'fraction_numerical': 0.0, 'mean_word_length': 2.7191011235955056, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1432477', 'n_tokens_mistral': 707, 'n_tokens_neox': 695, 'n_words': 259}