Project

General

Profile

Feature #22701 » 0001-Extend-test-data-for-issue-imported.patch

Gregor Schmidt, 2016-05-02 14:52

View differences:

test/fixtures/files/import_issues.csv
2 2
High;First;First description;2015-07-08;2015-08-25;;no;;PostgreSQL;;New category;dlopper;1
3 3
Normal;Child 1;Child description;;;1;yes;10;MySQL;2.0;New category;;2
4 4
Normal;Child of existing issue;Child description;;;#2;no;20;;2.1;Printing;;3
5
;Child of following issue;;;;5;;;;;;;
6
;Parent of previous issue;;;;;;;;;;;
test/unit/issue_import_test.rb
38 38
    import.save!
39 39

  
40 40
    version = new_record(Version) do
41
      assert_difference 'Issue.count', 3 do
41
      assert_difference 'Issue.count', 5 do
42 42
        import.run
43 43
      end
44 44
    end
......
51 51
    import.save!
52 52

  
53 53
    category = new_record(IssueCategory) do
54
      assert_difference 'Issue.count', 3 do
54
      assert_difference 'Issue.count', 5 do
55 55
        import.run
56 56
      end
57 57
    end
......
63 63
    import.mapping.merge!('parent_issue_id' => '5')
64 64
    import.save!
65 65

  
66
    issues = new_records(Issue, 3) { import.run }
66
    issues = new_records(Issue, 5) { import.run }
67 67
    assert_nil issues[0].parent
68 68
    assert_equal issues[0].id, issues[1].parent_id
69 69
    assert_equal 2, issues[2].parent_id
......
74 74
    import.mapping.merge!('assigned_to' => '11')
75 75
    import.save!
76 76

  
77
    issues = new_records(Issue, 3) { import.run }
78
    assert_equal [User.find(3), nil, nil], issues.map(&:assigned_to)
77
    issues = new_records(Issue, 5) { import.run }
78
    assert_equal [User.find(3), nil, nil], issues[0..2].map(&:assigned_to)
79 79
  end
80 80

  
81 81
  def test_user_custom_field_should_be_set
......
84 84
    import.mapping.merge!("cf_#{field.id}" => '11')
85 85
    import.save!
86 86

  
87
    issues = new_records(Issue, 3) { import.run }
87
    issues = new_records(Issue, 5) { import.run }
88 88
    assert_equal '3', issues.first.custom_field_value(field)
89 89
  end
90 90

  
......
93 93
    import.mapping.merge!('is_private' => '6')
94 94
    import.save!
95 95

  
96
    issues = new_records(Issue, 3) { import.run }
97
    assert_equal [false, true, false], issues.map(&:is_private)
96
    issues = new_records(Issue, 5) { import.run }
97
    assert_equal [false, true, false], issues[0..2].map(&:is_private)
98 98
  end
99 99

  
100 100
  def test_dates_should_be_parsed_using_date_format_setting
(1-1/3)