Revision 9f619a9e
Added by Kamil Szubrycht about 5 years ago
test/graphql/queries/host_query_test.rb | ||
---|---|---|
|
||
class Queries::HostQueryTest < ActiveSupport::TestCase
|
||
test 'fetching host attributes' do
|
||
host = FactoryBot.create(:host, :managed, :with_environment, :with_model, :with_facts)
|
||
hostgroup = FactoryBot.create(:hostgroup, :with_compute_resource)
|
||
host = FactoryBot.create(:host, :managed,
|
||
:with_environment,
|
||
:with_model,
|
||
:with_facts,
|
||
hostgroup: hostgroup)
|
||
|
||
query = <<-GRAPHQL
|
||
query (
|
||
... | ... | |
environment {
|
||
id
|
||
}
|
||
computeResource {
|
||
id
|
||
}
|
||
model {
|
||
id
|
||
}
|
||
... | ... | |
'environment' => {
|
||
'id' => Foreman::GlobalId.for(host.environment)
|
||
},
|
||
'computeResource' => {
|
||
'id' => Foreman::GlobalId.encode('ComputeResource', host.compute_resource.id)
|
||
},
|
||
'model' => {
|
||
'id' => Foreman::GlobalId.for(host.model)
|
||
},
|
Also available in: Unified diff
Fixes #26291 - graphql: add ComputeResource queries