Revision 305ee6f0
Added by Timo Goebel about 5 years ago
test/graphql/queries/hosts_query_test.rb | ||
---|---|---|
require 'test_helper'
|
||
|
||
class Queries::HostsQueryTest < GraphQLQueryTestCase
|
||
let(:query) do
|
||
<<-GRAPHQL
|
||
module Queries
|
||
class HostsQueryTest < GraphQLQueryTestCase
|
||
let(:query) do
|
||
<<-GRAPHQL
|
||
query {
|
||
hosts {
|
||
totalCount
|
||
... | ... | |
}
|
||
}
|
||
}
|
||
GRAPHQL
|
||
end
|
||
GRAPHQL
|
||
end
|
||
|
||
let(:data) { result['data']['hosts'] }
|
||
let(:data) { result['data']['hosts'] }
|
||
|
||
setup do
|
||
FactoryBot.create_list(:host, 2, :managed)
|
||
end
|
||
setup do
|
||
FactoryBot.create_list(:host, 2, :managed)
|
||
end
|
||
|
||
test 'fetching hosts attributes' do
|
||
assert_empty result['errors']
|
||
test 'fetching hosts attributes' do
|
||
assert_empty result['errors']
|
||
|
||
expected_count = Host.count
|
||
expected_count = Host.count
|
||
|
||
assert_not_equal 0, expected_count
|
||
assert_equal expected_count, data['totalCount']
|
||
assert_equal expected_count, data['edges'].count
|
||
assert_not_equal 0, expected_count
|
||
assert_equal expected_count, data['totalCount']
|
||
assert_equal expected_count, data['edges'].count
|
||
end
|
||
end
|
||
end
|
Also available in: Unified diff
fixes #26528 - graphql: refactor AuthorizedModelQuery to resolver