<commit_before>var 
  sendmail = require('../model/sendmail/mail.model'),
  sendmail_orig = sendmail.sendmail,
  config = require('../config'),
  mail,
  mongoose = require('mongoose'),
  Conn = require('../model/db.model'),
  conn_orig = Conn.connection,

  mail_option = {
    from: '<EMAIL>',
    to: '<EMAIL>; <EMAIL>',
    cc: '<EMAIL>',
    subject: 'test node',
    html: 'test content'
  },
  mail_info = {
    release: 'LR14',
    domain: 'KPI',
    for_date: new Date('2014-09-09'),
    platforms: ['SH-TEST1', 'SH-TEST2']
  };

module.exports.setUp = function (done) {
  sendmail.sendmail = function (mail_option, callback) {
    callback(null);
  };
  Conn.connection = mongoose.createConnection(config.db.url);
  mail = require('../model/mail.model');
  done();
};

module.exports.tearDown = function (done) {
  Conn.connection.close(function() {
    mongoose.disconnect(function(err){
      if (err) {
        console.log(err);
      }
      done();
    });
  });
};

module.exports.test_send_mail = function (test) {
  mail.send(mail_option, mail_info, function (err, mail_saved) {
    test.ifError(err);
    var 
      mail_id = mail_saved._id;

    mail.get_by_id(mail_id, function(err, r_mail) {
      test.ifError(err);
      test.equal(r_mail.mail_info.release, 'LR14');
      test.equal(r_mail.mail_info.domain, 'KPI');
      test.equal(r_mail.mail_info.for_date, String(new Date('2014-09-09')));
      test.equal(r_mail.mail_info.platforms.length, 2) ;
      test.done();
    });
  });
};<commit_msg>add mail get , send, remove test<commit_after>var 
  sendmail = require('../model/sendmail/mail.model'),
  sendmail_orig = sendmail.sendmail,
  config = require('../config'),
  mail,
  mongoose = require('mongoose'),
  Conn = require('../model/db.model'),
  conn_orig = Conn.connection,

  mail_option = {
    from: '<EMAIL>',
    to: '<EMAIL>; <EMAIL>',
    cc: '<EMAIL>',
    subject: 'test node',
    html: 'test content'
  },
  mail_info = {
    release: 'LR14',
    domain: 'KPI',
    for_date: new Date('2014-09-09'),
    platforms: ['SH-TEST1', 'SH-TEST2']
  };

module.exports.setUp = function (done) {
  sendmail.sendmail = function (mail_option, callback) {
    callback(null);
  };
  Conn.connection = mongoose.createConnection(config.db.url);
  mail = require('../model/mail.model');
  done();
};

module.exports.tearDown = function (done) {
  Conn.connection.close(function() {
    mongoose.disconnect(function(err){
      if (err) {
        console.log(err);
      }
      done();
    });
  });
};

module.exports.test_send_mail = function (test) {
  mail.send(mail_option, mail_info, function (err, mail_saved) {
    test.ifError(err);
    var 
      mail_id = mail_saved._id;

    mail.get_by_id(mail_id, function(err, r_mail) {
      test.ifError(err);
      test.equal(r_mail.mail_info.release, 'LR14');
      test.equal(r_mail.mail_info.domain, 'KPI');
      test.equal(r_mail.mail_info.for_date, String(new Date('2014-09-09')));
      test.equal(r_mail.mail_info.platforms.length, 2) ;
      r_mail.remove(function(err, d_mail) {
        test.ifError(err);
        test.equal(d_mail._id, r_mail._id);
        mail.get_by_id(d_mail._id, function(err, null_mail) {
          test.ifError(err);
          test.equal(null_mail, null);
          test.done();
        });
      });
    });
  });
};
{'fraction_non_alphanumeric': 0.1757648470305939, 'fraction_numerical': 0.013797240551889621, 'mean_word_length': 3.0424242424242425, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '185929', 'n_tokens_mistral': 1236, 'n_tokens_neox': 1205, 'n_words': 190}