blob: 3a1deb43bf8702adaf334510c42606804b328b8e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe API::Entities::Clusters::AgentAuthorization do
subject { described_class.new(authorization).as_json }
shared_examples 'generic authorization' do
it 'includes shared fields' do
expect(subject).to include(
id: authorization.agent_id,
config_project: a_hash_including(id: authorization.agent.project_id),
configuration: authorization.config
)
end
end
context 'project authorization' do
let(:authorization) { create(:agent_project_authorization) }
include_examples 'generic authorization'
end
context 'group authorization' do
let(:authorization) { create(:agent_group_authorization) }
include_examples 'generic authorization'
end
context 'implicit authorization' do
let(:agent) { create(:cluster_agent) }
let(:authorization) { Clusters::Agents::ImplicitAuthorization.new(agent: agent) }
include_examples 'generic authorization'
end
end
|