Commit c39c35f9 authored by Philip Cunningham's avatar Philip Cunningham Committed by Luke Duncalfe

Return NONE when DastSiteValidation does not exist

Alternative to PENDING_VALIDATION when no validation.
parent a3c102b8
......@@ -5247,6 +5247,11 @@ enum DastSiteProfileValidationStatusEnum {
"""
INPROGRESS_VALIDATION
"""
No site validation exists
"""
NONE
"""
Site validation process finished successfully
"""
......
......@@ -14391,6 +14391,12 @@
"inputFields": null,
"interfaces": null,
"enumValues": [
{
"name": "NONE",
"description": "No site validation exists",
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "PENDING_VALIDATION",
"description": "Site validation process has not started",
......@@ -4007,6 +4007,7 @@ Status of a container repository.
| ----- | ----------- |
| `FAILED_VALIDATION` | Site validation process finished but failed |
| `INPROGRESS_VALIDATION` | Site validation process is in progress |
| `NONE` | No site validation exists |
| `PASSED_VALIDATION` | Site validation process finished successfully |
| `PENDING_VALIDATION` | Site validation process has not started |
......
......@@ -2,6 +2,7 @@
module Types
class DastSiteProfileValidationStatusEnum < BaseEnum
value 'NONE', value: DastSiteValidation::NONE_STATE, description: 'No site validation exists'
value 'PENDING_VALIDATION', value: 'pending', description: 'Site validation process has not started'
value 'INPROGRESS_VALIDATION', value: 'inprogress', description: 'Site validation process is in progress'
value 'PASSED_VALIDATION', value: 'passed', description: 'Site validation process finished successfully'
......
......@@ -15,7 +15,7 @@ class DastSiteProfile < ApplicationRecord
delegate :dast_site_validation, to: :dast_site, allow_nil: true
def status
return DastSiteValidation::INITIAL_STATE unless dast_site_validation
return DastSiteValidation::NONE_STATE unless dast_site_validation
dast_site_validation.state
end
......
......@@ -27,6 +27,7 @@ class DastSiteValidation < ApplicationRecord
"#{url_base}/#{url_path}"
end
NONE_STATE = 'none'
INITIAL_STATE = 'pending'
state_machine :state, initial: INITIAL_STATE.to_sym do
......
---
title: Return NONE for GraphQL DastSiteValidation type status when there is no DAST site validation
merge_request: 48751
author:
type: changed
......@@ -74,12 +74,12 @@ RSpec.describe DastSiteProfile, type: :model do
describe '#status' do
context 'when dast_site_validation association does not exist' do
it 'is pending' do
it 'is none' do
subject.dast_site.update!(dast_site_validation_id: nil)
aggregate_failures do
expect(subject.dast_site_validation).to be_nil
expect(subject.status).to eq('pending')
expect(subject.status).to eq('none')
end
end
end
......
......@@ -93,10 +93,10 @@ RSpec.describe 'Query.project(fullPath).dastSiteProfile' do
end
context 'when there is no associated dast_site_validation' do
it 'returns a pending validation status' do
it 'returns a none validation status' do
dast_site_profile.dast_site_validation.destroy!
expect(dast_site_profile_response['validationStatus']).to eq('PENDING_VALIDATION')
expect(dast_site_profile_response['validationStatus']).to eq('NONE')
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment