<commit_before>require 'spec_helper'
require File.expand_path File.join(File.dirname(__FILE__), '..', '..', 'lib', 'cuttlefish_smtp_server')

describe CuttlefishSmtpConnection do
  describe '#receive_message' do
    it 'can queue large messages' do
      connection = CuttlefishSmtpConnection.new('')
      # This data is still about double what should fit in a TEXT
      # Something six times bigger than this causes mysql to lose connection on OS X for Matthew
      connection.current.data = 'a' * 1000000
      connection.receive_message
    end
  end
end<commit_msg>Add simple test for smtp authentication<commit_after>require 'spec_helper'
require File.expand_path File.join(File.dirname(__FILE__), '..', '..', 'lib', 'cuttlefish_smtp_server')

describe CuttlefishSmtpConnection do
  describe '#receive_message' do
    it 'can queue large messages' do
      connection = CuttlefishSmtpConnection.new('')
      # This data is still about double what should fit in a TEXT
      # Something six times bigger than this causes mysql to lose connection on OS X for Matthew
      connection.current.data = 'a' * 1000000
      connection.receive_message
    end
  end

  describe "#receive_plain_auth" do
    let(:app) { App.create!(name: "test") }
    let(:connection) { CuttlefishSmtpConnection.new('') }
    it { expect(connection.receive_plain_auth("foo", "bar")).to eq false }
    it { expect(connection.receive_plain_auth(app.smtp_username, "bar")).to eq false }
    it { expect(connection.receive_plain_auth(app.smtp_username, app.smtp_password)).to eq true }
  end
end
{'fraction_non_alphanumeric': 0.09968253968253968, 'fraction_numerical': 0.008888888888888889, 'mean_word_length': 4.116883116883117, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7575369', 'n_tokens_mistral': 495, 'n_tokens_neox': 457, 'n_words': 140}