2020-01-01 13:55:28 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
require "spec_helper"
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe Gitlab::GoogleCodeImport::Importer do
|
2015-04-26 12:48:37 +05:30
|
|
|
let(:mapped_user) { create(:user, username: "thilo123") }
|
2020-05-24 23:13:21 +05:30
|
|
|
let(:raw_data) { Gitlab::Json.parse(fixture_file("GoogleCodeProjectHosting.json")) }
|
2015-04-26 12:48:37 +05:30
|
|
|
let(:client) { Gitlab::GoogleCodeImport::Client.new(raw_data) }
|
2015-09-11 14:41:01 +05:30
|
|
|
let(:import_data) do
|
2015-04-26 12:48:37 +05:30
|
|
|
{
|
2015-09-11 14:41:01 +05:30
|
|
|
'repo' => client.repo('tint2').raw_data,
|
|
|
|
'user_map' => { 'thilo...' => "@#{mapped_user.username}" }
|
|
|
|
}
|
|
|
|
end
|
2020-10-24 23:57:45 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:project) { create(:project) }
|
2015-09-11 14:41:01 +05:30
|
|
|
|
|
|
|
subject { described_class.new(project) }
|
2015-04-26 12:48:37 +05:30
|
|
|
|
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(project.creator)
|
2015-04-26 12:48:37 +05:30
|
|
|
project.create_import_data(data: import_data)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "#execute" do
|
|
|
|
it "imports status labels" do
|
|
|
|
subject.execute
|
|
|
|
|
|
|
|
%w(New NeedInfo Accepted Wishlist Started Fixed Invalid Duplicate WontFix Incomplete).each do |status|
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(project.labels.find_by(name: "Status: #{status}")).not_to be_nil
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it "imports labels" do
|
|
|
|
subject.execute
|
|
|
|
|
|
|
|
%w(
|
2016-11-03 12:29:30 +05:30
|
|
|
Type-Defect Type-Enhancement Type-Task Type-Review Type-Other Milestone-0.12 Priority-Critical
|
|
|
|
Priority-High Priority-Medium Priority-Low OpSys-All OpSys-Windows OpSys-Linux OpSys-OSX Security
|
|
|
|
Performance Usability Maintainability Component-Panel Component-Taskbar Component-Battery
|
2015-04-26 12:48:37 +05:30
|
|
|
Component-Systray Component-Clock Component-Launcher Component-Tint2conf Component-Docs Component-New
|
|
|
|
).each do |label|
|
2020-01-01 13:55:28 +05:30
|
|
|
label = label.sub("-", ": ")
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(project.labels.find_by(name: label)).not_to be_nil
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it "imports issues" do
|
|
|
|
subject.execute
|
|
|
|
|
|
|
|
issue = project.issues.first
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(issue).not_to be_nil
|
2015-04-26 12:48:37 +05:30
|
|
|
expect(issue.iid).to eq(169)
|
|
|
|
expect(issue.author).to eq(project.creator)
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(issue.assignees).to eq([mapped_user])
|
2015-04-26 12:48:37 +05:30
|
|
|
expect(issue.state).to eq("closed")
|
|
|
|
expect(issue.label_names).to include("Priority: Medium")
|
|
|
|
expect(issue.label_names).to include("Status: Fixed")
|
|
|
|
expect(issue.label_names).to include("Type: Enhancement")
|
|
|
|
expect(issue.title).to eq("Scrolling through tasks")
|
|
|
|
expect(issue.state).to eq("closed")
|
|
|
|
expect(issue.description).to include("schattenpr\\.\\.\\.")
|
|
|
|
expect(issue.description).to include("November 18, 2009 00:20")
|
|
|
|
expect(issue.description).to include("Google Code")
|
|
|
|
expect(issue.description).to include('I like to scroll through the tasks with my scrollwheel (like in fluxbox).')
|
|
|
|
expect(issue.description).to include('Patch is attached that adds two new mouse-actions (next_task+prev_task)')
|
|
|
|
expect(issue.description).to include('that can be used for exactly that purpose.')
|
|
|
|
expect(issue.description).to include('all the best!')
|
|
|
|
expect(issue.description).to include('[tint2_task_scrolling.diff](https://storage.googleapis.com/google-code-attachments/tint2/issue-169/comment-0/tint2_task_scrolling.diff)')
|
|
|
|
expect(issue.description).to include('![screenshot.png](https://storage.googleapis.com/google-code-attachments/tint2/issue-169/comment-0/screenshot.png)')
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(issue.description).to include('![screenshot1.PNG](https://storage.googleapis.com/google-code-attachments/tint2/issue-169/comment-0/screenshot1.PNG)')
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it "imports issue comments" do
|
|
|
|
subject.execute
|
|
|
|
|
|
|
|
note = project.issues.first.notes.first
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(note).not_to be_nil
|
2015-04-26 12:48:37 +05:30
|
|
|
expect(note.note).to include("Comment 1")
|
|
|
|
expect(note.note).to include("@#{mapped_user.username}")
|
|
|
|
expect(note.note).to include("November 18, 2009 05:14")
|
|
|
|
expect(note.note).to include("applied, thanks.")
|
|
|
|
expect(note.note).to include("Status: Fixed")
|
|
|
|
expect(note.note).to include("~~Type: Defect~~")
|
|
|
|
expect(note.note).to include("Type: Enhancement")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|