<commit_before>require 'test_helper'

class GitHubLdapGroupTest < GitHub::Ldap::Test
  def self.test_server_options
    {user_fixtures: FIXTURES.join('github-with-subgroups.ldif').to_s}
  end

  def groups_domain
    @ldap.domain("ou=groups,dc=github,dc=com")
  end

  def setup
    @ldap  = GitHub::Ldap.new(options)
    @group = @ldap.group("cn=enterprise,ou=groups,dc=github,dc=com")
  end

  def test_subgroups
    assert_equal 3, @group.subgroups.size
  end

  def test_members_from_subgroups
    assert_equal 4, @group.members.size
  end

  def test_all_domain_groups
    groups = groups_domain.all_groups
    assert_equal 4, groups.size
  end

  def test_filter_domain_groups
    groups = groups_domain.filter_groups('devs')
    assert_equal 1, groups.size
  end

  def test_unknown_group
    refute @ldap.group("cn=foobar,ou=groups,dc=github,dc=com"),
      "Expected to not bind any group"
  end
end

class GitHubLdapLoopedGroupTest < GitHub::Ldap::Test
  def self.test_server_options
    {user_fixtures: FIXTURES.join('github-with-looped-subgroups.ldif').to_s}
  end

  def setup
    @group = GitHub::Ldap.new(options).group("cn=enterprise,ou=groups,dc=github,dc=com")
  end

  def test_members_from_subgroups
    assert_equal 4, @group.members.size
  end
end

class GitHubLdapMissingEntriesTest < GitHub::Ldap::Test
  def self.test_server_options
    {user_fixtures: FIXTURES.join('github-with-missing-entries.ldif').to_s}
  end

  def setup
    @group = GitHub::Ldap.new(options).group("cn=spaniards,ou=groups,dc=github,dc=com")
  end

  def test_ignore_missing_member_entries
    assert_equal 2, @group.members.size
  end
end<commit_msg>Make sure there is an ignored member in the group.<commit_after>require 'test_helper'

class GitHubLdapGroupTest < GitHub::Ldap::Test
  def self.test_server_options
    {user_fixtures: FIXTURES.join('github-with-subgroups.ldif').to_s}
  end

  def groups_domain
    @ldap.domain("ou=groups,dc=github,dc=com")
  end

  def setup
    @ldap  = GitHub::Ldap.new(options)
    @group = @ldap.group("cn=enterprise,ou=groups,dc=github,dc=com")
  end

  def test_subgroups
    assert_equal 3, @group.subgroups.size
  end

  def test_members_from_subgroups
    assert_equal 4, @group.members.size
  end

  def test_all_domain_groups
    groups = groups_domain.all_groups
    assert_equal 4, groups.size
  end

  def test_filter_domain_groups
    groups = groups_domain.filter_groups('devs')
    assert_equal 1, groups.size
  end

  def test_unknown_group
    refute @ldap.group("cn=foobar,ou=groups,dc=github,dc=com"),
      "Expected to not bind any group"
  end
end

class GitHubLdapLoopedGroupTest < GitHub::Ldap::Test
  def self.test_server_options
    {user_fixtures: FIXTURES.join('github-with-looped-subgroups.ldif').to_s}
  end

  def setup
    @group = GitHub::Ldap.new(options).group("cn=enterprise,ou=groups,dc=github,dc=com")
  end

  def test_members_from_subgroups
    assert_equal 4, @group.members.size
  end
end

class GitHubLdapMissingEntriesTest < GitHub::Ldap::Test
  def self.test_server_options
    {user_fixtures: FIXTURES.join('github-with-missing-entries.ldif').to_s}
  end

  def setup
    @ldap = GitHub::Ldap.new(options)
  end

  def test_load_right_members
    assert_equal 3, @ldap.domain("cn=spaniards,ou=groups,dc=github,dc=com").bind[:member].size
  end

  def test_ignore_missing_member_entries
    assert_equal 2, @ldap.group("cn=spaniards,ou=groups,dc=github,dc=com").members.size
  end
end
{'fraction_non_alphanumeric': 0.10729737525237958, 'fraction_numerical': 0.0037496394577444477, 'mean_word_length': 4.620745542949757, 'pattern_counts': {'":': 0, '<': 9, '<?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': '5067442', 'n_tokens_mistral': 1287, 'n_tokens_neox': 1242, 'n_words': 216}