Revision 305ee6f0
Added by Timo Goebel about 5 years ago
test/graphql/queries/compute_attribute_query_test.rb | ||
---|---|---|
require 'test_helper'
|
||
|
||
class Queries::ComputeAttributeQueryTest < GraphQLQueryTestCase
|
||
let(:query) do
|
||
<<-GRAPHQL
|
||
module Queries
|
||
class ComputeAttributeQueryTest < GraphQLQueryTestCase
|
||
let(:query) do
|
||
<<-GRAPHQL
|
||
query (
|
||
$id: String!
|
||
) {
|
||
... | ... | |
}
|
||
}
|
||
}
|
||
GRAPHQL
|
||
end
|
||
GRAPHQL
|
||
end
|
||
|
||
let(:compute_resource) { FactoryBot.create(:compute_resource, :vmware, uuid: 'Solutions') }
|
||
let(:compute_attribute) { compute_resource.compute_attributes.first }
|
||
let(:compute_resource) { FactoryBot.create(:compute_resource, :vmware, uuid: 'Solutions') }
|
||
let(:compute_attribute) { compute_resource.compute_attributes.first }
|
||
|
||
let(:global_id) { Foreman::GlobalId.for(compute_attribute) }
|
||
let(:variables) {{ id: global_id }}
|
||
let(:data) { result['data']['computeAttribute'] }
|
||
let(:global_id) { Foreman::GlobalId.for(compute_attribute) }
|
||
let(:variables) {{ id: global_id }}
|
||
let(:data) { result['data']['computeAttribute'] }
|
||
|
||
setup do
|
||
FactoryBot.create(:compute_profile, :with_compute_attribute, compute_resource: compute_resource)
|
||
end
|
||
setup do
|
||
FactoryBot.create(:compute_profile, :with_compute_attribute, compute_resource: compute_resource)
|
||
end
|
||
|
||
test 'fetching compute attribute attributes' do
|
||
assert_empty result['errors']
|
||
test 'fetching compute attribute attributes' do
|
||
assert_empty result['errors']
|
||
|
||
assert_equal global_id, data['id']
|
||
assert_equal compute_attribute.created_at.utc.iso8601, data['createdAt']
|
||
assert_equal compute_attribute.updated_at.utc.iso8601, data['updatedAt']
|
||
assert_equal compute_attribute.name, data['name']
|
||
assert_equal global_id, data['id']
|
||
assert_equal compute_attribute.created_at.utc.iso8601, data['createdAt']
|
||
assert_equal compute_attribute.updated_at.utc.iso8601, data['updatedAt']
|
||
assert_equal compute_attribute.name, data['name']
|
||
|
||
assert_record compute_attribute.compute_resource, data['computeResource']
|
||
assert_record compute_attribute.compute_resource, data['computeResource']
|
||
end
|
||
end
|
||
end
|
Also available in: Unified diff
fixes #26528 - graphql: refactor AuthorizedModelQuery to resolver