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/architecture_query_test.rb
require 'test_helper'
class Queries::ArchitectureQueryTest < GraphQLQueryTestCase
let(:query) do
<<-GRAPHQL
module Queries
class ArchitectureQueryTest < GraphQLQueryTestCase
let(:query) do
<<-GRAPHQL
query (
$id: String!
) {
......
}
}
}
GRAPHQL
end
GRAPHQL
end
let(:hosts) { FactoryBot.create_list(:host, 2) }
let(:architecture) { FactoryBot.create(:architecture, hosts: hosts) }
let(:hosts) { FactoryBot.create_list(:host, 2) }
let(:architecture) { FactoryBot.create(:architecture, hosts: hosts) }
let(:global_id) { Foreman::GlobalId.for(architecture) }
let(:variables) {{ id: global_id }}
let(:data) { result['data']['architecture'] }
let(:global_id) { Foreman::GlobalId.for(architecture) }
let(:variables) {{ id: global_id }}
let(:data) { result['data']['architecture'] }
test 'fetching architecture attributes' do
assert_empty result['errors']
test 'fetching architecture attributes' do
assert_empty result['errors']
assert_equal global_id, data['id']
assert_equal architecture.created_at.utc.iso8601, data['createdAt']
assert_equal architecture.updated_at.utc.iso8601, data['updatedAt']
assert_equal architecture.name, data['name']
assert_equal global_id, data['id']
assert_equal architecture.created_at.utc.iso8601, data['createdAt']
assert_equal architecture.updated_at.utc.iso8601, data['updatedAt']
assert_equal architecture.name, data['name']
assert_collection architecture.hosts, data['hosts'], type_name: 'Host'
assert_collection architecture.hosts, data['hosts'], type_name: 'Host'
end
end
end

Also available in: Unified diff