Project

General

Profile

Defect #11552 » defect-11552.patch

William Roush, 2012-07-31 21:11

View differences:

/dev/null Thu Jan 01 00:00:00 1970 +0000 → test/fixtures/mail_handler/ticket_assign_user_with_dash_in_name.eml Tue Jul 31 15:09:50 2012 -0400
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" <john.doe@somenet.foo>
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

  
19
Assigned to: IS - Operations
test/unit/mail_handler_test.rb Mon Jul 30 01:32:31 2012 +0000 → test/unit/mail_handler_test.rb Tue Jul 31 15:09:50 2012 -0400
397 397
      end
398 398
    end
399 399
  end
400
  
401
  # Defect #11552, users with dashes in their names cannot be assigned to using their full name.
402
  def test_assign_to_user_with_dash_in_name
403
    # Create the reported user "IS - Operations"
404
    created_user = User.new(:mail => 'dashtest@somenet.foo',
405
      :firstname => 'IS -',
406
      :lastname => 'Operations')
407
    created_user.login = 'dashtest'
408
    created_user.save!
409
    
410
    # Add user to project.
411
    project = Project.find_by_identifier('ecookbook')
412
    assert_not_nil project
413
    member = Member.create(:project => project, :user =>  created_user, :role_ids => [1, 2])
414
    
415
    # Confirm the user got added correctly.
416
    get_user = User.find_by_login('dashtest')
417
    assert_not_nil get_user
418
    assert_equal 'IS -', get_user.firstname
419
    
420
    # Bring in an anonymous e-mail, assigned to IS - Operations.
421
    issue = submit_email('ticket_assign_user_with_dash_in_name.eml',
422
      :allow_override => 'assigned_to',
423
      :issue => { :project => 'ecookbook' },
424
      :no_permission_check => '1',
425
      :unknown_user => 'accept')
426
    assert issue.is_a?(Issue)
427
    assert !issue.new_record?
428
    issue.save!
429
    
430
    # Reload and check and make sure the user is there.
431
    issue.reload
432
    assert_equal get_user, issue.assigned_to
433
  end  
400 434

  
401 435
  def test_add_issue_should_send_email_notification
402 436
    Setting.notified_events = ['issue_added']
(1-1/2)