Sha256: 2d0d73a5804844e10a4071592a3b4f05334baadfc10ce223b9bf30e33c897868

Contents?: true

Size: 1.27 KB

Versions: 16

Compression:

Stored size: 1.27 KB

Contents

require 'test_puppet_helper'

module Queries
  class EnvironmentQueryTest < GraphQLQueryTestCase
    let(:query) do
      <<-GRAPHQL
      query (
        $id: String!
      ) {
        environment(id: $id) {
          id
          createdAt
          updatedAt
          name
          locations {
            totalCount
            edges {
              node {
                id
              }
            }
          }
          organizations {
            totalCount
            edges {
              node {
                id
              }
            }
          }
        }
      }
      GRAPHQL
    end

    let(:environment) { FactoryBot.create(:environment) }

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

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

      assert_equal global_id, data['id']
      assert_equal environment.created_at.utc.iso8601, data['createdAt']
      assert_equal environment.updated_at.utc.iso8601, data['updatedAt']
      assert_equal environment.name, data['name']

      assert_collection environment.locations, data['locations']
      assert_collection environment.organizations, data['organizations']
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
foreman_puppet-2.0.7 test/graphql/queries/environment_query_test.rb
foreman_puppet-2.0.6 test/graphql/queries/environment_query_test.rb
foreman_puppet-2.0.5 test/graphql/queries/environment_query_test.rb
foreman_puppet-2.0.4 test/graphql/queries/environment_query_test.rb
foreman_puppet-2.0.3 test/graphql/queries/environment_query_test.rb
foreman_puppet-2.0.2 test/graphql/queries/environment_query_test.rb
foreman_puppet-2.0.0 test/graphql/queries/environment_query_test.rb
foreman_puppet-1.0.5 test/graphql/queries/environment_query_test.rb
foreman_puppet-1.0.4 test/graphql/queries/environment_query_test.rb
foreman_puppet-2.0.0.alpha.2 test/graphql/queries/environment_query_test.rb
foreman_puppet-1.0.3 test/graphql/queries/environment_query_test.rb
foreman_puppet-1.0.2 test/graphql/queries/environment_query_test.rb
foreman_puppet-1.0.1 test/graphql/queries/environment_query_test.rb
foreman_puppet-1.0.0 test/graphql/queries/environment_query_test.rb
foreman_puppet-1.0.0.rc.2 test/graphql/queries/environment_query_test.rb
foreman_puppet-1.0.0.rc.1 test/graphql/queries/environment_query_test.rb