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
a77271f5
Commit
a77271f5
authored
Oct 12, 2021
by
Philip Cunningham
Committed by
Vasilii Iakliushin
Oct 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add seeds for DAST Profiles
parent
5e8f3a30
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
3 deletions
+59
-3
ee/db/fixtures/development/21_dast_profiles.rb
ee/db/fixtures/development/21_dast_profiles.rb
+56
-0
ee/spec/factories/dast/profiles.rb
ee/spec/factories/dast/profiles.rb
+1
-1
ee/spec/factories/dast_scanner_profiles.rb
ee/spec/factories/dast_scanner_profiles.rb
+1
-1
ee/spec/factories/dast_site_profiles.rb
ee/spec/factories/dast_site_profiles.rb
+1
-1
No files found.
ee/db/fixtures/development/21_dast_profiles.rb
0 → 100644
View file @
a77271f5
# frozen_string_literal: true
class
Gitlab::Seeder::DastProfiles
attr_reader
:project
def
initialize
(
project
)
@project
=
project
FactoryBot
.
definition_file_paths
<<
Rails
.
root
.
join
(
'ee'
,
'spec'
,
'factories'
)
FactoryBot
.
reload
# rubocop:disable Cop/ActiveRecordAssociationReload
end
def
seed!
3
.
times
{
create_profile
}
2
.
times
do
token
=
create_token
(
create_profile
)
create_validation
(
token
)
end
end
private
def
create_profile
site_profile
=
create_site_profile
(
create_site
)
FactoryBot
.
create
(
:dast_profile
,
project:
project
,
dast_site_profile:
site_profile
)
end
def
create_site
FactoryBot
.
create
(
:dast_site
,
project:
project
,
url:
"https://
#{
SecureRandom
.
hex
}
.com"
)
end
def
create_site_profile
(
site
)
FactoryBot
.
create
(
:dast_site_profile
,
project:
project
,
dast_site:
site
)
end
def
create_token
(
profile
)
url
=
profile
.
dast_site_profile
.
dast_site
.
url
FactoryBot
.
create
(
:dast_site_token
,
project:
project
,
url:
url
)
end
def
create_validation
(
token
)
FactoryBot
.
create
(
:dast_site_validation
,
dast_site_token:
token
)
end
end
Gitlab
::
Seeder
.
quiet
do
Project
.
all
.
each
do
|
project
|
next
unless
project
.
repo_exists?
seeder
=
Gitlab
::
Seeder
::
DastProfiles
.
new
(
project
)
seeder
.
seed!
end
end
ee/spec/factories/dast/profiles.rb
View file @
a77271f5
...
...
@@ -8,7 +8,7 @@ FactoryBot.define do
dast_scanner_profile
{
association
:dast_scanner_profile
,
project:
project
}
sequence
:name
do
|
i
|
"
#{
FFaker
::
Product
.
product_name
.
truncate
(
200
)
}
-
#{
i
}
"
"
#{
FFaker
::
Product
.
product_name
.
truncate
(
192
)
}
#{
SecureRandom
.
hex
(
4
)
}
-
#{
i
}
"
end
description
{
FFaker
::
Product
.
product_name
}
...
...
ee/spec/factories/dast_scanner_profiles.rb
View file @
a77271f5
...
...
@@ -3,7 +3,7 @@
FactoryBot
.
define
do
factory
:dast_scanner_profile
do
sequence
:name
do
|
i
|
"
#{
FFaker
::
Product
.
product_name
.
truncate
(
200
)
}
-
#{
i
}
"
"
#{
FFaker
::
Product
.
product_name
.
truncate
(
192
)
}
#{
SecureRandom
.
hex
(
4
)
}
-
#{
i
}
"
end
before
(
:create
)
do
|
dast_scanner_profile
|
...
...
ee/spec/factories/dast_site_profiles.rb
View file @
a77271f5
...
...
@@ -7,7 +7,7 @@ FactoryBot.define do
dast_site
{
association
:dast_site
,
project:
project
}
sequence
:name
do
|
i
|
"
#{
FFaker
::
Product
.
product_name
.
truncate
(
200
)
}
-
#{
i
}
"
"
#{
FFaker
::
Product
.
product_name
.
truncate
(
192
)
}
#{
SecureRandom
.
hex
(
4
)
}
-
#{
i
}
"
end
auth_enabled
{
true
}
...
...
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