Sha256: d494e7edcfbca7817defd62e37acd1f363ddf6f63127a12c8431f8c72382e5e4

Contents?: true

Size: 1.68 KB

Versions: 5

Compression:

Stored size: 1.68 KB

Contents

# frozen_string_literal: true

require 'test_plugin_helper'

module ForemanWebhooks
  module Queries
    class WebhookQueryTest < GraphQLQueryTestCase
      let(:query) do
        <<-GRAPHQL
        query (
          $id: String!
        ) {
          webhook(id: $id) {
            id
            createdAt
            updatedAt
            name
            targetUrl
            events
            httpMethod
            httpContentType
            enabled
            verifySsl
            sslCaCerts
            user
            webhookTemplate {
              id
            }
          }
        }
        GRAPHQL
      end

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

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

        assert_equal global_id, data['id']
        assert_equal webhook.created_at.utc.iso8601, data['createdAt']
        assert_equal webhook.updated_at.utc.iso8601, data['updatedAt']
        assert_equal webhook.name, data['name']
        assert_equal webhook.target_url, data['targetUrl']
        assert_equal webhook.events, data['events']
        assert_equal webhook.http_method, data['httpMethod']
        assert_equal webhook.http_content_type, data['httpContentType']
        assert_equal webhook.enabled, data['enabled']
        assert_equal webhook.verify_ssl, data['verifySsl']
        assert_equal webhook.ssl_ca_certs, data['sslCaCerts']
        assert_equal webhook.user, data['user']

        assert_record webhook.webhook_template, data['webhookTemplate']
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_webhooks-4.0.0 test/graphql/foreman_webhooks/queries/webhook_query_test.rb
foreman_webhooks-3.2.3 test/graphql/foreman_webhooks/queries/webhook_query_test.rb
foreman_webhooks-3.2.2 test/graphql/foreman_webhooks/queries/webhook_query_test.rb
foreman_webhooks-3.2.1 test/graphql/foreman_webhooks/queries/webhook_query_test.rb
foreman_webhooks-3.2.0 test/graphql/foreman_webhooks/queries/webhook_query_test.rb