Project

General

Profile

Defect #35131 » 0001-Allow-Unique-ID-and-relation-fields-to-be-auto-mappe.patch

Marius BĂLTEANU, 2021-04-22 23:09

View differences:

app/models/issue_import.rb
32 32
    'start_date' => 'field_start_date',
33 33
    'due_date' => 'field_due_date',
34 34
    'estimated_hours' => 'field_estimated_hours',
35
    'done_ratio' => 'field_done_ratio'
35
    'done_ratio' => 'field_done_ratio',
36
    'unique_id' => 'field_unique_id',
37
    'relation_duplicates' => 'label_duplicates',
38
    'relation_duplicated' => 'label_duplicated_by',
39
    'relation_blocks' => 'label_blocks',
40
    'relation_blocked' => 'label_blocked_by',
41
    'relation_relates' => 'label_relates_to',
42
    'relation_precedes' => 'label_precedes',
43
    'relation_follows' =>  'label_follows',
44
    'relation_copied_to' => 'label_copied_to',
45
    'relation_copied_from' => 'label_copied_from'
36 46
  }
37 47

  
38 48
  def self.menu_item
test/fixtures/files/import_issues_auto_mapping.csv
1
priority;Subject;start_date;parent;private;progress;custom;"target version";category;user;estimated_hours;tracker;status;database;cf_6;
2
High;First;2015-07-08;;no;;PostgreSQL;;New category;dlopper;1;bug;new;"PostgreSQL, Oracle";2;"Column with empty header"
1
priority;Subject;start_date;parent;private;progress;custom;"target version";category;user;estimated_hours;tracker;status;database;cf_6;unique_id;"Is duplicate of"
2
High;First;2015-07-08;;no;;PostgreSQL;;New category;dlopper;1;bug;new;"PostgreSQL, Oracle";2;1;4;"Column with empty header"
test/functional/imports_controller_test.rb
244 244
    assert_select 'select[name=?]', 'import_settings[mapping][cf_1]' do
245 245
      assert_select 'option[value="13"][selected="selected"]', :text => 'database'
246 246
    end
247

  
248
    # 'unique_id' should be auto selected because
249
    # - 'unique_id' exists in the import file
250
    assert_select 'select[name=?]', 'import_settings[mapping][unique_id]' do
251
      assert_select 'option[value="15"][selected="selected"]', :text => 'unique_id'
252
    end
253

  
254
    # 'relation_duplicates' should be auto selected because
255
    # - 'Is duplicate of' exists in the import file
256
    assert_select 'select[name=?]', 'import_settings[mapping][relation_duplicates]' do
257
      assert_select 'option[value="16"][selected="selected"]', :text => 'Is duplicate of'
258
    end
247 259
  end
248 260

  
249 261
  def test_post_mapping_should_update_mapping
(4-4/4)