Sha256: 20e8bcdeb172277fc27ba2c2782c16270c41dcfb02af5886ab6e3003b72adcb3

Contents?: true

Size: 733 Bytes

Versions: 2

Compression:

Stored size: 733 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'

class GraphQLControllerTest < ActionDispatch::IntegrationTest
  test "string arguments are tainted" do
    response = run_graphql('{ stringArgumentTaintTestCase(input:"asdf") }')

    assert_equal({ "data" => { "stringArgumentTaintTestCase" => true } }, response)
  end

  test "string in object arguments are tainted" do
    response = run_graphql('{ objectArgumentTaintTestCase(input: { topLevelString: "Asdf" }) }')

    assert_equal({ "data" => { "objectArgumentTaintTestCase" => true } }, response)
  end

  def run_graphql(query)
    params = {
      query: query
    }

    post graphql_url, params: params
    assert_response :success

    response.parsed_body
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tainted_love-0.4.1 tests/rails/test/controllers/graphql_controller_test.rb
tainted_love-0.4.0 tests/rails/test/controllers/graphql_controller_test.rb