Project

General

Profile

Feature #17699 » email_from_parens_format_test.diff

Stanislav German-Evtushenko, 2014-08-18 12:53

View differences:

test/unit/mail_handler_test.rb (working copy)
304 304
    end
305 305
  end
306 306

  
307
  def test_add_issue_by_created_user_parentheses
308
    Setting.default_language = 'en'
309
    assert_difference 'User.count' do
310
      issue = submit_email(
311
                'ticket_by_unknown_user_parentheses.eml',
312
                :issue => {:project => 'ecookbook'},
313
                :unknown_user => 'create'
314
              )
315
      assert issue.is_a?(Issue)
316
      assert issue.author.active?
317
      assert_equal 'john.doe@somenet.foo', issue.author.mail
318
      assert_equal 'John', issue.author.firstname
319
      assert_equal 'Doe', issue.author.lastname
320

  
321
      # account information
322
      email = ActionMailer::Base.deliveries.first
323
      assert_not_nil email
324
      assert email.subject.include?('account activation')
325
      login = mail_body(email).match(/\* Login: (.*)$/)[1].strip
326
      password = mail_body(email).match(/\* Password: (.*)$/)[1].strip
327
      assert_equal issue.author, User.try_to_login(login, password)
328
    end
329
  end
330

  
307 331
  def test_created_user_should_be_added_to_groups
308 332
    group1 = Group.generate!
309 333
    group2 = Group.generate!
test/fixtures/mail_handler/ticket_by_unknown_user_parentheses.eml (revision 0)
1
Return-Path: <john.doe@somenet.foo>
2
Received: from osiris ([127.0.0.1])
3
	by OSIRIS
4
	with hMailServer ; Sun, 22 Jun 2008 12:28:07 +0200
5
Message-ID: <000501c8d452$a95cd7e0$0a00a8c0@osiris>
6
From: john.doe@somenet.foo (John Doe)
7
To: <redmine@somenet.foo>
8
Subject: Ticket by unknown user
9
Date: Sun, 22 Jun 2008 12:28:07 +0200
10
MIME-Version: 1.0
11
Content-Type: text/plain;
12
	format=flowed;
13
	charset="iso-8859-1";
14
	reply-type=original
15
Content-Transfer-Encoding: 7bit
16

  
17
This is a ticket submitted by an unknown user.
18

  
(2-2/6)