Project

General

Profile

« Previous | Next » 

Revision 305ee6f0

Added by Timo Goebel about 5 years ago

fixes #26528 - graphql: refactor AuthorizedModelQuery to resolver

View differences:

test/graphql/queries/smart_proxy_query_test.rb
require 'test_helper'
class Queries::SmartProxyQueryTest < GraphQLQueryTestCase
let(:query) do
<<-GRAPHQL
module Queries
class SmartProxyQueryTest < GraphQLQueryTestCase
let(:query) do
<<-GRAPHQL
query (
$id: String!
) {
......
}
}
}
GRAPHQL
end
GRAPHQL
end
let(:hosts) { FactoryBot.create_list(:host, 2) }
let(:smart_proxy) { FactoryBot.create(:smart_proxy, hosts: hosts) }
let(:hosts) { FactoryBot.create_list(:host, 2) }
let(:smart_proxy) { FactoryBot.create(:smart_proxy, hosts: hosts) }
let(:global_id) { Foreman::GlobalId.for(smart_proxy) }
let(:variables) {{ id: global_id }}
let(:data) { result['data']['smartProxy'] }
let(:global_id) { Foreman::GlobalId.for(smart_proxy) }
let(:variables) {{ id: global_id }}
let(:data) { result['data']['smartProxy'] }
test 'fetching smart proxy attributes' do
assert_empty result['errors']
test 'fetching smart proxy attributes' do
assert_empty result['errors']
assert_equal global_id, data['id']
assert_equal smart_proxy.created_at.utc.iso8601, data['createdAt']
assert_equal smart_proxy.updated_at.utc.iso8601, data['updatedAt']
assert_equal smart_proxy.name, data['name']
assert_equal smart_proxy.url, data['url']
assert_equal global_id, data['id']
assert_equal smart_proxy.created_at.utc.iso8601, data['createdAt']
assert_equal smart_proxy.updated_at.utc.iso8601, data['updatedAt']
assert_equal smart_proxy.name, data['name']
assert_equal smart_proxy.url, data['url']
assert_collection smart_proxy.hosts, data['hosts'], type_name: 'Host'
assert_collection smart_proxy.hosts, data['hosts'], type_name: 'Host'
end
end
end

Also available in: Unified diff