diff options
Diffstat (limited to 'spec/graphql')
3 files changed, 21 insertions, 16 deletions
diff --git a/spec/graphql/resolvers/clusters/agent_tokens_resolver_spec.rb b/spec/graphql/resolvers/clusters/agent_tokens_resolver_spec.rb index 6b8b88928d8..9b54d466681 100644 --- a/spec/graphql/resolvers/clusters/agent_tokens_resolver_spec.rb +++ b/spec/graphql/resolvers/clusters/agent_tokens_resolver_spec.rb @@ -7,6 +7,7 @@ RSpec.describe Resolvers::Clusters::AgentTokensResolver do it { expect(described_class.type).to eq(Types::Clusters::AgentTokenType) } it { expect(described_class.null).to be_truthy } + it { expect(described_class.arguments.keys).to contain_exactly('status') } describe '#resolve' do let(:agent) { create(:cluster_agent) } @@ -23,6 +24,14 @@ RSpec.describe Resolvers::Clusters::AgentTokensResolver do expect(subject).to eq([matching_token2, matching_token1]) end + context 'token status is specified' do + let!(:revoked_token) { create(:cluster_agent_token, :revoked, agent: agent) } + + subject { resolve(described_class, obj: agent, ctx: ctx, args: { status: 'revoked' }) } + + it { is_expected.to contain_exactly(revoked_token) } + end + context 'user does not have permission' do let(:user) { create(:user, developer_projects: [agent.project]) } diff --git a/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb b/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb index 3fcfa967452..9fe4c78f551 100644 --- a/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb +++ b/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb @@ -62,24 +62,12 @@ RSpec.describe ResolvesPipelines do context 'filtering by source' do let_it_be(:source_pipeline) { create(:ci_pipeline, project: project, source: 'web') } - context 'when `dast_view_scans` feature flag is disabled' do - before do - stub_feature_flags(dast_view_scans: false) - end - - it 'does not filter by source' do - expect(resolve_pipelines(source: 'web')).to contain_exactly(*all_pipelines, source_pipeline) - end + it 'does filter by source' do + expect(resolve_pipelines(source: 'web')).to contain_exactly(source_pipeline) end - context 'when `dast_view_scans` feature flag is enabled' do - it 'does filter by source' do - expect(resolve_pipelines(source: 'web')).to contain_exactly(source_pipeline) - end - - it 'returns all the pipelines' do - expect(resolve_pipelines).to contain_exactly(*all_pipelines, source_pipeline) - end + it 'returns all the pipelines' do + expect(resolve_pipelines).to contain_exactly(*all_pipelines, source_pipeline) end end diff --git a/spec/graphql/types/clusters/agent_token_status_enum_spec.rb b/spec/graphql/types/clusters/agent_token_status_enum_spec.rb new file mode 100644 index 00000000000..071e4050cfb --- /dev/null +++ b/spec/graphql/types/clusters/agent_token_status_enum_spec.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Types::Clusters::AgentTokenStatusEnum do + it { expect(described_class.graphql_name).to eq('AgentTokenStatus') } + it { expect(described_class.values.keys).to match_array(Clusters::AgentToken.statuses.keys.map(&:upcase)) } +end |