Sha256: ce9d163eeb291cfcffcdba1fda88cbbb399890cee5530f8d4caec34f39d7ae25

Contents?: true

Size: 1.24 KB

Versions: 45

Compression:

Stored size: 1.24 KB

Contents

require 'test_puppet_helper'

module Queries
  class OrganizationQueryTest < GraphQLQueryTestCase
    let(:query) do
      <<-GRAPHQL
      query (
        $id: String!
      ) {
        organization(id: $id) {
          id
          environments {
            totalCount
            edges {
              node {
                id
              }
            }
          }
          puppetclasses {
            totalCount
            edges {
              node {
                id
              }
            }
          }
        }
      }
      GRAPHQL
    end

    let(:environment) { FactoryBot.create(:environment) }
    let(:organization_object) { FactoryBot.create(:organization, environments: [environment]) }

    let(:global_id) { Foreman::GlobalId.for(organization_object) }
    let(:variables) { { id: global_id } }
    let(:data) { result['data']['organization'] }

    setup do
      FactoryBot.create(:puppetclass, environments: [environment])
    end

    test 'fetching organization attributes' do
      assert_empty result['errors']

      assert_equal global_id, data['id']
      assert_collection organization_object.environments, data['environments']
      assert_collection organization_object.puppetclasses, data['puppetclasses']
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
foreman_puppet-8.1.0 test/graphql/queries/organization_query_test.rb
foreman_puppet-8.0.0 test/graphql/queries/organization_query_test.rb
foreman_puppet-6.4.0 test/graphql/queries/organization_query_test.rb
foreman_puppet-7.0.0 test/graphql/queries/organization_query_test.rb
foreman_puppet-6.3.0 test/graphql/queries/organization_query_test.rb
foreman_puppet-6.2.0 test/graphql/queries/organization_query_test.rb
foreman_puppet-6.1.1 test/graphql/queries/organization_query_test.rb
foreman_puppet-5.1.3 test/graphql/queries/organization_query_test.rb
foreman_puppet-6.1.0 test/graphql/queries/organization_query_test.rb
foreman_puppet-6.0.1 test/graphql/queries/organization_query_test.rb
foreman_puppet-6.0.0 test/graphql/queries/organization_query_test.rb
foreman_puppet-5.1.2 test/graphql/queries/organization_query_test.rb
foreman_puppet-4.1.1 test/graphql/queries/organization_query_test.rb
foreman_puppet-5.1.1 test/graphql/queries/organization_query_test.rb
foreman_puppet-5.1.0 test/graphql/queries/organization_query_test.rb
foreman_puppet-4.1.0 test/graphql/queries/organization_query_test.rb
foreman_puppet-4.0.4 test/graphql/queries/organization_query_test.rb
foreman_puppet-5.0.0 test/graphql/queries/organization_query_test.rb
foreman_puppet-4.0.3 test/graphql/queries/organization_query_test.rb
foreman_puppet-4.0.2 test/graphql/queries/organization_query_test.rb