<commit_before># Run some basic specs on Krb5::Keytab to check that:
# - the FFI interface can load the library and call functions
# - the error handling in the FFI interface is working
describe KerberosAuthenticator::Krb5::Keytab do

  describe 'when I try to resolve the default Keytab' do
    it 'must return a Keytab' do
      a_keytab = lambda { |obj| obj.is_a?(KerberosAuthenticator::Krb5::Keytab) }
      KerberosAuthenticator::Krb5::Keytab.default.should.be a_keytab
    end
  end

  describe 'when I try to resolve a Keytab with a type of FILE and a path' do
    it 'must return a Keytab with that type and path' do
      kt = KerberosAuthenticator::Krb5::Keytab.new_with_name('FILE:/etc/krb5.keytab')
      kt.type.should.equal 'FILE'
      kt.path.should.equal '/etc/krb5.keytab'
    end
  end

  describe 'when I try to resolve a Keytab with a type of FILE and a non-ASCII path' do
    it 'must return a Keytab with that type and path' do
      kt = KerberosAuthenticator::Krb5::Keytab.new_with_name('FILE:/итд/krb5.keytab')
      kt.type.should.equal 'FILE'
      kt.path.should.equal '/итд/krb5.keytab'
    end
  end

  describe 'when I try to resolve a Keytab with a nonsensical type' do
    it 'must raise an Error' do
      -> { KerberosAuthenticator::Krb5::Keytab.new_with_name('DOJO:講道館') }.should.raise KerberosAuthenticator::Krb5::Error
    end
  end

end
<commit_msg>Spec Keytab#has_content?<commit_after># Run some basic specs on Krb5::Keytab to check that:
# - the FFI interface can load the library and call functions
# - the error handling in the FFI interface is working
describe KerberosAuthenticator::Krb5::Keytab do
  before do
    if ENV['KA_SPEC_KEYTAB']
      keytab = Tempfile.new('krb5_kt', encoding: 'binary')
      keytab.write(Base64.decode64(ENV['KA_SPEC_KEYTAB']))
      keytab.close

      ENV['KA_SPEC_KT_PATH'] = keytab.path
    end

    @keytab_path = ENV['KA_SPEC_KT_PATH']
  end

  describe 'when I try to resolve the default Keytab' do
    it 'must return a Keytab' do
      a_keytab = lambda { |obj| obj.is_a?(KerberosAuthenticator::Krb5::Keytab) }
      KerberosAuthenticator::Krb5::Keytab.default.should.be a_keytab
    end
  end

  describe 'when I try to resolve a Keytab with a type of FILE and a path' do
    it 'must return a Keytab with that type and path' do
      kt = KerberosAuthenticator::Krb5::Keytab.new_with_name('FILE:/etc/krb5.keytab')
      kt.type.should.equal 'FILE'
      kt.path.should.equal '/etc/krb5.keytab'
    end
  end

  describe 'when I try to resolve a Keytab with a type of FILE and a non-ASCII path' do
    it 'must return a Keytab with that type and path' do
      kt = KerberosAuthenticator::Krb5::Keytab.new_with_name('FILE:/итд/krb5.keytab')
      kt.type.should.equal 'FILE'
      kt.path.should.equal '/итд/krb5.keytab'
    end
  end

  describe 'when I try to check the contents of a Keytab that does not exist' do
    it 'must return false' do
      kt = KerberosAuthenticator::Krb5::Keytab.new_with_name('FILE:./does/not/exist.keytab')
      kt.has_content?.should.equal false
    end
  end

  if ENV['KA_SPEC_KT_PATH']
    describe 'when I try to check the contents of a Keytab that does exist and contain entries' do
      it 'must return true' do
        kt = KerberosAuthenticator::Krb5::Keytab.new_with_name("FILE:#{@keytab_path}")
        kt.has_content?.should.equal true
      end
    end
  end

  describe 'when I try to resolve a Keytab with a nonsensical type' do
    it 'must raise an Error' do
      -> { KerberosAuthenticator::Krb5::Keytab.new_with_name('DOJO:講道館') }.should.raise KerberosAuthenticator::Krb5::Error
    end
  end

end

{'fraction_non_alphanumeric': 0.09395604395604396, 'fraction_numerical': 0.008516483516483516, 'mean_word_length': 3.4079903147699757, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1415013', 'n_tokens_mistral': 1302, 'n_tokens_neox': 1304, 'n_words': 384}