Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
ff2193a3
Commit
ff2193a3
authored
Dec 09, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs
parent
cc30a9f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
lib/gitlab/bitbucket_import/importer.rb
lib/gitlab/bitbucket_import/importer.rb
+1
-5
spec/lib/gitlab/bitbucket_import/importer_spec.rb
spec/lib/gitlab/bitbucket_import/importer_spec.rb
+13
-1
No files found.
lib/gitlab/bitbucket_import/importer.rb
View file @
ff2193a3
...
@@ -58,7 +58,7 @@ module Gitlab
...
@@ -58,7 +58,7 @@ module Gitlab
updated_at:
issue
.
updated_at
updated_at:
issue
.
updated_at
)
)
assign_label
(
issue
,
label_name
)
issue
.
labels
<<
@labels
[
label_name
]
if
issue
.
persisted?
if
issue
.
persisted?
client
.
issue_comments
(
repo
,
issue
.
iid
).
each
do
|
comment
|
client
.
issue_comments
(
repo
,
issue
.
iid
).
each
do
|
comment
|
...
@@ -92,10 +92,6 @@ module Gitlab
...
@@ -92,10 +92,6 @@ module Gitlab
end
end
end
end
def
assign_label
(
issue
,
label_name
)
issue
.
labels
<<
@labels
[
label_name
]
end
def
import_pull_requests
def
import_pull_requests
pull_requests
=
client
.
pull_requests
(
repo
)
pull_requests
=
client
.
pull_requests
(
repo
)
...
...
spec/lib/gitlab/bitbucket_import/importer_spec.rb
View file @
ff2193a3
...
@@ -18,6 +18,7 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
...
@@ -18,6 +18,7 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
"closed"
# undocumented status
"closed"
# undocumented status
]
]
end
end
let
(
:sample_issues_statuses
)
do
let
(
:sample_issues_statuses
)
do
issues
=
[]
issues
=
[]
...
@@ -26,6 +27,7 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
...
@@ -26,6 +27,7 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
id:
index
,
id:
index
,
state:
status
,
state:
status
,
title:
"Issue
#{
index
}
"
,
title:
"Issue
#{
index
}
"
,
kind:
'bug'
,
content:
{
content:
{
raw:
"Some content to issue
#{
index
}
"
,
raw:
"Some content to issue
#{
index
}
"
,
markup:
"markdown"
,
markup:
"markdown"
,
...
@@ -38,6 +40,7 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
...
@@ -38,6 +40,7 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
end
end
let
(
:project_identifier
)
{
'namespace/repo'
}
let
(
:project_identifier
)
{
'namespace/repo'
}
let
(
:data
)
do
let
(
:data
)
do
{
{
'bb_session'
=>
{
'bb_session'
=>
{
...
@@ -46,6 +49,7 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
...
@@ -46,6 +49,7 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
}
}
}
}
end
end
let
(
:project
)
do
let
(
:project
)
do
create
(
create
(
:project
,
:project
,
...
@@ -53,7 +57,9 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
...
@@ -53,7 +57,9 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
import_data:
ProjectImportData
.
new
(
credentials:
data
)
import_data:
ProjectImportData
.
new
(
credentials:
data
)
)
)
end
end
let
(
:importer
)
{
Gitlab
::
BitbucketImport
::
Importer
.
new
(
project
)
}
let
(
:importer
)
{
Gitlab
::
BitbucketImport
::
Importer
.
new
(
project
)
}
let
(
:issues_statuses_sample_data
)
do
let
(
:issues_statuses_sample_data
)
do
{
{
count:
sample_issues_statuses
.
count
,
count:
sample_issues_statuses
.
count
,
...
@@ -77,6 +83,12 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
...
@@ -77,6 +83,12 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
headers:
{
"Content-Type"
=>
"application/json"
},
headers:
{
"Content-Type"
=>
"application/json"
},
body:
issues_statuses_sample_data
.
to_json
)
body:
issues_statuses_sample_data
.
to_json
)
stub_request
(
:get
,
"https://api.bitbucket.org/2.0/repositories/namespace/repo?pagelen=50&sort=created_on"
).
with
(
:headers
=>
{
'Accept'
=>
'*/*'
,
'Accept-Encoding'
=>
'gzip;q=1.0,deflate;q=0.6,identity;q=0.3'
,
'Authorization'
=>
'Bearer'
,
'User-Agent'
=>
'Faraday v0.9.2'
}).
to_return
(
:status
=>
200
,
:body
=>
""
,
:headers
=>
{})
sample_issues_statuses
.
each_with_index
do
|
issue
,
index
|
sample_issues_statuses
.
each_with_index
do
|
issue
,
index
|
stub_request
(
stub_request
(
:get
,
:get
,
...
@@ -97,7 +109,7 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
...
@@ -97,7 +109,7 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
end
end
it
'map statuses to open or closed'
do
it
'map statuses to open or closed'
do
# HACK: Bitbucket::Representation.const_get('Issue') seems to return Issue without this
# HACK: Bitbucket::Representation.const_get('Issue') seems to return
::
Issue without this
Bitbucket
::
Representation
::
Issue
.
new
({})
Bitbucket
::
Representation
::
Issue
.
new
({})
importer
.
execute
importer
.
execute
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment