Project

General

Profile

« Previous | Next » 

Revision 0d9c9615

Added by Timo Goebel about 5 years ago

fixes #26492 - graphql: add media queries

View differences:

test/graphql/queries/operatingsystem_query_test.rb
title
type
fullname
family
hosts {
totalCount
edges {
......
}
}
}
media {
totalCount
edges {
node {
id
}
}
}
}
}
GRAPHQL
end
let(:hosts) { FactoryBot.create_list(:host, 2) }
let(:operatingsystem) { FactoryBot.create(:operatingsystem, hosts: hosts) }
let(:medium) { FactoryBot.create(:medium) }
let(:operatingsystem) { FactoryBot.create(:operatingsystem, family: 'Redhat', hosts: hosts, media: [medium]) }
let(:global_id) { Foreman::GlobalId.for(operatingsystem) }
let(:variables) {{ id: global_id }}
......
assert_equal operatingsystem.title, data['title']
assert_equal operatingsystem.type, data['type']
assert_equal operatingsystem.fullname, data['fullname']
assert_equal operatingsystem.family, data['family']
assert_collection operatingsystem.hosts, data['hosts'], type_name: 'Host'
assert_collection operatingsystem.media, data['media']
end
end

Also available in: Unified diff