<commit_before>
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))

require 'postfix_admin'
require 'postfix_admin/cli'


include PostfixAdmin

# [fixtures]
# Domain:
#  ALL
#  example.com
#  example.org
#
# Admin:
#  <EMAIL>   Super Admin
#  <EMAIL>
#
# Mailbox, Alias:
#  <EMAIL>
#
# Alias:
#  <EMAIL>

def config_initialize
  CLI.config_file = File.join(File.dirname(__FILE__) , 'postfix_admin.conf')
end

def db_clear
  DomainAdmin.all.destroy
  Mailbox.all.destroy
  Alias.all.destroy
  Domain.all.destroy
  Admin.all.destroy
end

def create_domain(domain_name)
  domain = Domain.new
  domain.attributes = {
    :domain_name  => domain_name,
    :description  => domain_name,
    :maxaliases   => 30,
    :maxmailboxes => 30,
    :maxquota     => 100,
  }
  domain.save
end

def db_initialize
  db_clear

  create_domain('ALL')
  create_domain('example.com')
  create_domain('example.org')

  username = "<EMAIL>"
  admin = Admin.new
  admin.attributes = {
    :username => username,
    :password => 'password',
  }
  admin.save

  domain = Domain.find('example.com')
  domain.admins << admin
  domain.save

  all_admin = Admin.new
  all_admin.attributes = {
    :username => '<EMAIL>',
    :password => 'password',
  }
  all_admin.save

  all_domain = Domain.find('ALL')
  all_domain.admins << all_admin
  all_domain.save

  address = "<EMAIL>"
  mail_alias = Alias.new
  mail_alias.attributes = {
    :address  => address,
    :goto     => address,
  }
  domain.aliases << mail_alias

  forward = Alias.new
  forward.attributes = {
    :address  => '<EMAIL>',
    :goto     => 'example.jp',
  }
  domain.aliases << forward

  domain.save

  path = "example.com/<EMAIL>@<EMAIL>/"
  mailbox = Mailbox.new
  mailbox.attributes = {
    :username => address,
    :password => 'password',
    :name     => '',<commit_msg>Fixed got address of fixture<commit_after>
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))

require 'postfix_admin'
require 'postfix_admin/cli'


include PostfixAdmin

# [fixtures]
# Domain:
#  ALL
#  example.com
#  example.org
#
# Admin:
#  <EMAIL>   Super Admin
#  <EMAIL>
#
# Mailbox, Alias:
#  <EMAIL>
#
# Alias:
#  <EMAIL> -> <EMAIL>

def config_initialize
  CLI.config_file = File.join(File.dirname(__FILE__) , 'postfix_admin.conf')
end

def db_clear
  DomainAdmin.all.destroy
  Mailbox.all.destroy
  Alias.all.destroy
  Domain.all.destroy
  Admin.all.destroy
end

def create_domain(domain_name)
  domain = Domain.new
  domain.attributes = {
    :domain_name  => domain_name,
    :description  => domain_name,
    :maxaliases   => 30,
    :maxmailboxes => 30,
    :maxquota     => 100,
  }
  domain.save
end

def db_initialize
  db_clear

  create_domain('ALL')
  create_domain('example.com')
  create_domain('example.org')

  username = "<EMAIL>"
  admin = Admin.new
  admin.attributes = {
    :username => username,
    :password => 'password',
  }
  admin.save

  domain = Domain.find('example.com')
  domain.admins << admin
  domain.save

  all_admin = Admin.new
  all_admin.attributes = {
    :username => '<EMAIL>',
    :password => 'password',
  }
  all_admin.save

  all_domain = Domain.find('ALL')
  all_domain.admins << all_admin
  all_domain.save

  address = "<EMAIL>"
  mail_alias = Alias.new
  mail_alias.attributes = {
    :address  => address,
    :goto     => address,
  }
  domain.aliases << mail_alias

  forward = Alias.new
  forward.attributes = {
    :address  => '<EMAIL>',
    :goto     => '<EMAIL>',
  }
  domain.aliases << forward

  domain.save

  path = "example.com/<EMAIL>/"
  mailbox = Mailbox.new
  mailbox.attributes = {
    :username => address,
    :password => 'password',
    :name     => '',
{'fraction_non_alphanumeric': 0.14577100897470766, 'fraction_numerical': 0.003807451726951319, 'mean_word_length': 3.193842645381984, 'pattern_counts': {'":': 0, '<': 40, '<?xml version=': 0, '>': 57, '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': '5481794', 'n_tokens_mistral': 1366, 'n_tokens_neox': 1316, 'n_words': 245}