Commit e6b80ea8 authored by George Koltsov's avatar George Koltsov Committed by Stan Hu

Add award emojis to Epics on Group Export

parent 6db44dad
---
title: Add award emoji information of Epics and Epic Notes to Group Import/Export
merge_request: 24003
author:
type: changed
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::ImportExport::GroupTreeRestorer do
include ImportExport::CommonUtil
let(:user) { create(:user) }
let(:group) { create(:group, name: 'group', path: 'group') }
let(:shared) { Gitlab::ImportExport::Shared.new(group) }
let(:group_tree_restorer) { described_class.new(user: user, shared: shared, group: group, group_hash: nil) }
before do
setup_import_export_config('group_exports/complex')
group.add_owner(user)
group_tree_restorer.restore
end
describe 'restore group tree' do
context 'epics' do
it 'has group epics' do
expect(group.epics.count).to eq(5)
end
it 'has award emoji' do
expect(group.epics.first.award_emoji.first.name).to eq('thumbsup')
end
end
context 'epic notes' do
it 'has epic notes' do
expect(group.epics.first.notes.count).to eq(4)
end
it 'has award emoji on epic notes' do
expect(group.epics.first.notes.first.award_emoji.first.name).to eq('drum')
end
end
end
end
...@@ -14,6 +14,8 @@ describe Gitlab::ImportExport::GroupTreeSaver do ...@@ -14,6 +14,8 @@ describe Gitlab::ImportExport::GroupTreeSaver do
let_it_be(:board) { create(:board, group: group, assignee: user, labels: [label]) } let_it_be(:board) { create(:board, group: group, assignee: user, labels: [label]) }
let_it_be(:note) { create(:note, noteable: epic) } let_it_be(:note) { create(:note, noteable: epic) }
let_it_be(:note_event) { create(:event, :created, target: note, author: user) } let_it_be(:note_event) { create(:event, :created, target: note, author: user) }
let_it_be(:epic_emoji) { create(:award_emoji, awardable: epic) }
let_it_be(:epic_note_emoji) { create(:award_emoji, awardable: note) }
let(:shared) { Gitlab::ImportExport::Shared.new(group) } let(:shared) { Gitlab::ImportExport::Shared.new(group) }
let(:export_path) { "#{Dir.tmpdir}/group_tree_saver_spec_ee" } let(:export_path) { "#{Dir.tmpdir}/group_tree_saver_spec_ee" }
...@@ -82,6 +84,20 @@ describe Gitlab::ImportExport::GroupTreeSaver do ...@@ -82,6 +84,20 @@ describe Gitlab::ImportExport::GroupTreeSaver do
notes = epic_json['notes'] notes = epic_json['notes']
expect(notes.first['events'].first['action']).to eq(note_event.action) expect(notes.first['events'].first['action']).to eq(note_event.action)
end end
it "saves epic's award emojis" do
expect_successful_save(group_tree_saver)
award_emoji = epic_json['award_emoji'].first
expect(award_emoji['name']).to eq(epic_emoji.name)
end
it "saves epic's note award emojis" do
expect_successful_save(group_tree_saver)
award_emoji = epic_json['notes'].first['award_emoji'].first
expect(award_emoji['name']).to eq(epic_note_emoji.name)
end
end end
context 'boards relation' do context 'boards relation' do
......
...@@ -46,10 +46,12 @@ ee: ...@@ -46,10 +46,12 @@ ee:
group: group:
- epics: - epics:
- :parent - :parent
- :award_emoji
- events: - events:
- :push_event_payload - :push_event_payload
- notes: - notes:
- :author - :author
- :award_emoji
- events: - events:
- :push_event_payload - :push_event_payload
- boards: - boards:
......
...@@ -482,7 +482,18 @@ ...@@ -482,7 +482,18 @@
"type": null, "type": null,
"author": { "author": {
"name": "Administrator" "name": "Administrator"
} },
"award_emoji": [
{
"id": 12,
"name": "drum",
"user_id": 1,
"awardable_type": "Note",
"awardable_id": 44170,
"created_at": "2019-11-05T15:32:21.287Z",
"updated_at": "2019-11-05T15:32:21.287Z"
}
]
}, },
{ {
"id": 44168, "id": 44168,
...@@ -574,6 +585,17 @@ ...@@ -574,6 +585,17 @@
"name": "Administrator" "name": "Administrator"
} }
} }
],
"award_emoji": [
{
"id": 12,
"name": "thumbsup",
"user_id": 1,
"awardable_type": "Epic",
"awardable_id": 13622,
"created_at": "2019-11-05T15:37:21.287Z",
"updated_at": "2019-11-05T15:37:21.287Z"
}
] ]
}, },
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment