826 B · text History 4b6fe3b
defmodule OhMyExOhIrcd.IRC.AuthTest do
  use ExUnit.Case, async: true

  alias OhMyExOhIrcd.IRC.Auth

  describe "verify_sasl_plain/1" do
    test "rejects non-base64 input" do
      assert {:error, :malformed} = Auth.verify_sasl_plain("not!base64!")
    end

    test "rejects payload missing NUL separators" do
      assert {:error, :malformed} = Auth.verify_sasl_plain(Base.encode64("nonulsathere"))
    end
  end

  describe "verify_pass/1" do
    test "rejects malformed input with no separator" do
      assert {:error, :malformed} = Auth.verify_pass("justanemail@example.com")
    end

    # Verify_pass/verify_sasl_plain happy paths require DB access — they go
    # through Accounts.get_user_by_email_and_password/2. Those are covered by
    # an integration test that runs against the Phoenix test repo.
  end
end