Commit d7f3b4d4 authored by Max Woolf's avatar Max Woolf

Add specs for ExternalAuditEventDestinationType

Additionally, moves ExternalAuditEventDestinationType class
to EE, rather than the EE overrides since there is no CE class.
parent ac5eb557
# frozen_string_literal: true
module EE
module Types
module AuditEvents
class ExternalAuditEventDestinationType < ::Types::BaseObject
graphql_name 'ExternalAuditEventDestination'
description 'Represents an external resource to send audit events to'
field :id, GraphQL::Types::ID,
null: false,
description: 'ID of the destination.'
field :destination_url, GraphQL::Types::String,
null: false,
description: 'External destination to send audit events to.'
field :group, ::Types::GroupType,
null: false,
description: 'Group the destination belongs to.'
field :verification_token, GraphQL::Types::String,
null: false,
description: 'Verification token to validate source of event.'
end
end
end
end
...@@ -94,7 +94,7 @@ module EE ...@@ -94,7 +94,7 @@ module EE
description: "Group's DORA metrics." description: "Group's DORA metrics."
field :external_audit_event_destinations, field :external_audit_event_destinations,
EE::Types::AuditEvents::ExternalAuditEventDestinationType.connection_type, ::Types::AuditEvents::ExternalAuditEventDestinationType.connection_type,
null: true, null: true,
description: 'External locations that receive audit events belonging to the group.', description: 'External locations that receive audit events belonging to the group.',
authorize: :admin_external_audit_events authorize: :admin_external_audit_events
......
...@@ -16,7 +16,7 @@ module Mutations ...@@ -16,7 +16,7 @@ module Mutations
required: true, required: true,
description: 'Group path.' description: 'Group path.'
field :external_audit_event_destination, EE::Types::AuditEvents::ExternalAuditEventDestinationType, field :external_audit_event_destination, ::Types::AuditEvents::ExternalAuditEventDestinationType,
null: true, null: true,
description: 'Destination created.' description: 'Destination created.'
......
...@@ -16,7 +16,7 @@ module Mutations ...@@ -16,7 +16,7 @@ module Mutations
required: false, required: false,
description: 'Destination URL to change.' description: 'Destination URL to change.'
field :external_audit_event_destination, EE::Types::AuditEvents::ExternalAuditEventDestinationType, field :external_audit_event_destination, ::Types::AuditEvents::ExternalAuditEventDestinationType,
null: true, null: true,
description: 'Updated destination.' description: 'Updated destination.'
......
# frozen_string_literal: true
module Types
module AuditEvents
class ExternalAuditEventDestinationType < ::Types::BaseObject
graphql_name 'ExternalAuditEventDestination'
description 'Represents an external resource to send audit events to'
authorize :admin_external_audit_events
field :id, GraphQL::Types::ID,
null: false,
description: 'ID of the destination.'
field :destination_url, GraphQL::Types::String,
null: false,
description: 'External destination to send audit events to.'
field :group, ::Types::GroupType,
null: false,
description: 'Group the destination belongs to.'
field :verification_token, GraphQL::Types::String,
null: false,
description: 'Verification token to validate source of event.'
end
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe GitlabSchema.types['ExternalAuditEventDestination'] do
let(:fields) do
%i[id destination_url group verification_token]
end
specify { expect(described_class.graphql_name).to eq('ExternalAuditEventDestination') }
specify { expect(described_class).to have_graphql_fields(fields) }
specify { expect(described_class).to require_graphql_authorizations(:admin_external_audit_events) }
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