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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
fbd5f110
Commit
fbd5f110
authored
Jul 06, 2021
by
Andrejs Cunskis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fetch github repo id
parent
e1c779cd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
6 deletions
+21
-6
qa/qa/resource/project.rb
qa/qa/resource/project.rb
+2
-1
qa/qa/resource/project_imported_from_github.rb
qa/qa/resource/project_imported_from_github.rb
+15
-2
qa/qa/specs/features/api/1_manage/import_github_repo_spec.rb
qa/qa/specs/features/api/1_manage/import_github_repo_spec.rb
+4
-3
No files found.
qa/qa/resource/project.rb
View file @
fbd5f110
...
@@ -24,7 +24,8 @@ module QA
...
@@ -24,7 +24,8 @@ module QA
:visibility
,
:visibility
,
:template_name
,
:template_name
,
:import
,
:import
,
:import_status
:import_status
,
:import_error
attribute
:group
do
attribute
:group
do
Group
.
fabricate!
Group
.
fabricate!
...
...
qa/qa/resource/project_imported_from_github.rb
View file @
fbd5f110
# frozen_string_literal: true
# frozen_string_literal: true
require
'
securerandom
'
require
'
github_api
'
module
QA
module
QA
module
Resource
module
Resource
class
ProjectImportedFromGithub
<
Resource
::
Project
class
ProjectImportedFromGithub
<
Resource
::
Project
attribute
:github_repo_id
attribute
:github_repo_id
do
github_repository_path
.
split
(
'/'
).
yield_self
do
|
path
|
github_repos
.
get
(
user:
path
[
0
],
repo:
path
[
1
]).
id
end
end
def
fabricate!
def
fabricate!
self
.
import
=
true
self
.
import
=
true
...
@@ -46,6 +50,15 @@ module QA
...
@@ -46,6 +50,15 @@ module QA
def
transform_api_resource
(
api_resource
)
def
transform_api_resource
(
api_resource
)
api_resource
api_resource
end
end
private
# Github repos client
#
# @return [Github::Client::Repos]
def
github_repos
@github_repo
||=
Github
::
Client
::
Repos
.
new
(
oauth_token:
github_personal_access_token
)
end
end
end
end
end
end
end
qa/qa/specs/features/api/1_manage/import_github_repo_spec.rb
View file @
fbd5f110
...
@@ -3,6 +3,9 @@
...
@@ -3,6 +3,9 @@
module
QA
module
QA
RSpec
.
describe
'Manage'
,
:github
,
:requires_admin
do
RSpec
.
describe
'Manage'
,
:github
,
:requires_admin
do
describe
'Project import'
do
describe
'Project import'
do
let!
(
:github_user
)
{
'gitlab-qa-github'
}
let!
(
:github_repo
)
{
'test-project'
}
let!
(
:api_client
)
{
Runtime
::
API
::
Client
.
as_admin
}
let!
(
:api_client
)
{
Runtime
::
API
::
Client
.
as_admin
}
let!
(
:group
)
{
Resource
::
Group
.
fabricate_via_api!
{
|
resource
|
resource
.
api_client
=
api_client
}
}
let!
(
:group
)
{
Resource
::
Group
.
fabricate_via_api!
{
|
resource
|
resource
.
api_client
=
api_client
}
}
let!
(
:user
)
do
let!
(
:user
)
do
...
@@ -17,9 +20,8 @@ module QA
...
@@ -17,9 +20,8 @@ module QA
project
.
name
=
'imported-project'
project
.
name
=
'imported-project'
project
.
group
=
group
project
.
group
=
group
project
.
github_personal_access_token
=
Runtime
::
Env
.
github_access_token
project
.
github_personal_access_token
=
Runtime
::
Env
.
github_access_token
project
.
github_repository_path
=
'gitlab-qa-github/test-project'
project
.
github_repository_path
=
"
#{
github_user
}
/
#{
github_repo
}
"
project
.
api_client
=
api_client
project
.
api_client
=
api_client
project
.
github_repo_id
=
'310217317'
# id of 'test-project'
end
end
end
end
...
@@ -50,7 +52,6 @@ module QA
...
@@ -50,7 +52,6 @@ module QA
def
verify_repository_import
def
verify_repository_import
expect
(
imported_project
.
api_response
).
to
include
(
expect
(
imported_project
.
api_response
).
to
include
(
description:
'A new repo for test'
,
description:
'A new repo for test'
,
import_status:
'finished'
,
import_error:
nil
import_error:
nil
)
)
end
end
...
...
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