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
ab90fe8b
Commit
ab90fe8b
authored
Sep 16, 2021
by
Andrejs Cunskis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
E2E: Group badge migration validation
Fix badge Override web_url method
parent
2428ecbd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
100 additions
and
2 deletions
+100
-2
qa/qa/resource/group_badge.rb
qa/qa/resource/group_badge.rb
+73
-0
qa/qa/resource/group_base.rb
qa/qa/resource/group_base.rb
+16
-0
qa/qa/specs/features/api/1_manage/bulk_import_group_spec.rb
qa/qa/specs/features/api/1_manage/bulk_import_group_spec.rb
+11
-2
No files found.
qa/qa/resource/group_badge.rb
0 → 100644
View file @
ab90fe8b
# frozen_string_literal: true
module
QA
module
Resource
class
GroupBadge
<
Base
attributes
:id
,
:name
,
:link_url
,
:image_url
,
:group
# API get path
#
# @return [String]
def
api_get_path
"/groups/
#{
CGI
.
escape
(
group
.
full_path
)
}
/badges/
#{
id
}
"
end
# API post path
#
# @return [String]
def
api_post_path
"/groups/
#{
CGI
.
escape
(
group
.
full_path
)
}
/badges"
end
# Params for label creation
#
# @return [Hash]
def
api_post_body
{
link_url:
link_url
,
image_url:
image_url
}
end
# Override base method as this particular resource does not expose a web_url property
#
# @param [Hash] resource
# @return [String]
def
resource_web_url
(
_resource
);
end
# Object comparison
#
# @param [QA::Resource::GroupBadge] other
# @return [Boolean]
def
==
(
other
)
other
.
is_a?
(
GroupBadge
)
&&
comparable_badge
==
other
.
comparable_badge
end
# Override inspect for a better rspec failure diff output
#
# @return [String]
def
inspect
JSON
.
pretty_generate
(
comparable_badge
)
end
protected
# Return subset of fields for comparing badges
#
# @return [Hash]
def
comparable_badge
reload!
unless
api_response
api_response
.
slice
(
:name
,
:link_url
,
:image_url
)
end
end
end
end
qa/qa/resource/group_base.rb
View file @
ab90fe8b
...
...
@@ -46,6 +46,22 @@ module QA
end
end
# Get group badges
#
# @return [Array<QA::Resource::GroupBadge>]
def
badges
parse_body
(
api_get_from
(
"
#{
api_get_path
}
/badges"
)).
map
do
|
badge
|
GroupBadge
.
init
do
|
resource
|
resource
.
api_client
=
api_client
resource
.
group
=
self
resource
.
id
=
badge
[
:id
]
resource
.
name
=
badge
[
:name
]
resource
.
link_url
=
badge
[
:link_url
]
resource
.
image_url
=
badge
[
:image_url
]
end
end
end
# API get path
#
# @return [String]
...
...
qa/qa/specs/features/api/1_manage/bulk_import_group_spec.rb
View file @
ab90fe8b
...
...
@@ -89,7 +89,7 @@ module QA
end
end
context
'with milestones'
do
context
'with milestones
and badges
'
do
let
(
:source_milestone
)
do
Resource
::
GroupMilestone
.
fabricate_via_api!
do
|
milestone
|
milestone
.
api_client
=
api_client
...
...
@@ -99,10 +99,17 @@ module QA
before
do
source_milestone
Resource
::
GroupBadge
.
fabricate_via_api!
do
|
badge
|
badge
.
api_client
=
api_client
badge
.
group
=
source_group
badge
.
link_url
=
"http://example.com/badge"
badge
.
image_url
=
"http://shields.io/badge"
end
end
it
(
'successfully imports group milestones'
,
'successfully imports group milestones
and badges
'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2245'
)
do
expect
{
imported_group
.
import_status
}.
to
eventually_eq
(
'finished'
).
within
(
import_wait_duration
)
...
...
@@ -113,6 +120,8 @@ module QA
expect
(
imported_milestone
.
iid
).
to
eq
(
source_milestone
.
iid
)
expect
(
imported_milestone
.
created_at
).
to
eq
(
source_milestone
.
created_at
)
expect
(
imported_milestone
.
updated_at
).
to
eq
(
source_milestone
.
updated_at
)
expect
(
imported_group
.
badges
).
to
eq
(
source_group
.
badges
)
end
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