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
74b5a36e
Commit
74b5a36e
authored
Aug 13, 2021
by
Alex Pooley
Committed by
Dmitry Gruzd
Aug 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dast meta tag valid case
parent
0cf05541
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
ee/spec/models/dast_site_validation_spec.rb
ee/spec/models/dast_site_validation_spec.rb
+14
-10
No files found.
ee/spec/models/dast_site_validation_spec.rb
View file @
74b5a36e
...
...
@@ -3,7 +3,9 @@
require
'spec_helper'
RSpec
.
describe
DastSiteValidation
,
type: :model
do
subject
{
create
(
:dast_site_validation
)
}
let_it_be
(
:dast_site_token
)
{
create
(
:dast_site_token
)
}
subject
{
create
(
:dast_site_validation
,
dast_site_token:
dast_site_token
)
}
let_it_be
(
:another_dast_site_validation
)
{
create
(
:dast_site_validation
)
}
...
...
@@ -17,15 +19,19 @@ RSpec.describe DastSiteValidation, type: :model do
it
{
is_expected
.
to
validate_presence_of
(
:dast_site_token_id
)
}
context
'when strategy is meta_tag'
do
shared_examples
'meta tag validation is disabled'
do
subject
{
build
(
:dast_site_validation
,
validation_strategy: :meta_tag
)
}
subject
{
build
(
:dast_site_validation
,
dast_site_token:
dast_site_token
,
validation_strategy: :meta_tag
)
}
shared_examples
'meta tag validation is disabled'
do
it
'is not valid'
,
:aggregate_failures
do
expect
(
subject
).
not_to
be_valid
expect
(
subject
.
errors
.
full_messages
).
to
include
(
'Meta tag validation is not enabled'
)
end
end
context
'when dast_meta_tag_validation and dast_runner_site_validation are enabled'
do
it
{
is_expected
.
to
be_valid
}
end
context
'when dast_meta_tag_validation is disabled'
do
before
do
stub_feature_flags
(
dast_meta_tag_validation:
false
)
...
...
@@ -46,13 +52,11 @@ RSpec.describe DastSiteValidation, type: :model do
describe
'before_create'
do
describe
'#set_normalized_url_base'
do
subject
do
dast_site_token
=
create
(
let_it_be
(
:dast_site_token
)
do
create
(
:dast_site_token
,
url:
generate
(
:url
)
+
'/'
+
SecureRandom
.
hex
+
'?'
+
{
param:
SecureRandom
.
hex
}.
to_query
)
create
(
:dast_site_validation
,
dast_site_token:
dast_site_token
)
end
it
'normalizes the dast_site_token url'
do
...
...
@@ -152,7 +156,7 @@ RSpec.describe DastSiteValidation, type: :model do
describe
'#retry'
do
context
'when state=failed'
do
subject
{
create
(
:dast_site_validation
,
state: :failed
)
}
subject
{
create
(
:dast_site_validation
,
state: :failed
,
dast_site_token:
dast_site_token
)
}
it
'returns true'
do
expect
(
subject
.
retry
).
to
eq
(
true
)
...
...
@@ -182,7 +186,7 @@ RSpec.describe DastSiteValidation, type: :model do
describe
'#fail_op'
do
context
'when state=failed'
do
subject
{
create
(
:dast_site_validation
,
state: :failed
)
}
subject
{
create
(
:dast_site_validation
,
state: :failed
,
dast_site_token:
dast_site_token
)
}
it
'returns false'
do
expect
(
subject
.
fail_op
).
to
eq
(
false
)
...
...
@@ -212,7 +216,7 @@ RSpec.describe DastSiteValidation, type: :model do
describe
'#pass'
do
context
'when state=inprogress'
do
subject
{
create
(
:dast_site_validation
,
state: :inprogress
)
}
subject
{
create
(
:dast_site_validation
,
state: :inprogress
,
dast_site_token:
dast_site_token
)
}
it
'returns true'
do
expect
(
subject
.
pass
).
to
eq
(
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