Sha256: 74b78c20e8bbbb8db7f7aa375cd099a50ffda3ccb50bf079d9fc33b3730fdc39

Contents?: true

Size: 1.3 KB

Versions: 29

Compression:

Stored size: 1.3 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']

      expect(data['name']).must_equal(environment.name)
      expect(data['id']).must_equal(global_id)
      expect(data['createdAt']).must_equal(environment.created_at.utc.iso8601)
      expect(data['updatedAt']).must_equal(environment.updated_at.utc.iso8601)

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

Version data entries

29 entries across 29 versions & 1 rubygems

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