Sha256: 2ff8eed87693d715cf8f76bfcbf80e1017d0ad1f5e066b22aeb02476679cf7c1

Contents?: true

Size: 1.68 KB

Versions: 1

Compression:

Stored size: 1.68 KB

Contents

require_relative "test_helper"

class MockClientTest < MiniTest::Unit::TestCase
  def setup
    FakeWeb.allow_net_connect = false

    @client = Dalia::Api::SurveyPlatform::MockClient.new({ :account_id => "RESEARCHER_ACCOUNT_UUID_MOCK" })
  end

  def test_fetch_surveys
    response = @client.fetch_surveys

    assert_equal(3, response[:surveys].length)
  end

  def test_fetch_survey
    response = @client.fetch_survey(:survey_id => "SURVEY_UUID")

    assert_equal(4, response[:survey][:questions].length)
  end

  def test_send_survey
    response = @client.send_survey(:data => "DATA")

    assert_equal("280", response[:survey][:credits][:amount])
  end

  def test_update_survey
    response = @client.update_survey(:survey_id => "SURVEY_UUID", :data => "DATA")

    assert_equal("280", response[:survey][:credits][:amount])
  end

  def test_fetch_completions
    response = @client.fetch_completions(:survey_id => "SURVEY_UUID")

    assert_equal(3, response[:completions].length)
  end

  def test_fetch_completions_csv
    response = @client.fetch_completions_csv(:survey_id => "SURVEY_UUID")

    assert_equal(8, response.lines.length)
  end

  def test_fetch_completion
    response = @client.fetch_completion(:survey_id => "SURVEY_UUID", :completion_id => "COMPLETION_UUID")

    assert_equal("completed", response[:completion][:state])
  end

  def test_fetch_survey_price
    response = @client.fetch_survey_price(:account_id => "RESEARCHER_ACCOUNT_UUID_MOCK")

    assert_equal(1.0, response[:price][:total])
  end

  def test_create_query
    response = @client.create_query(:survey_id => "SURVEY_UUID", :question_id => "QUESTION_UUID")

    assert_equal("Qb5faf2", response[:question_id])
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dalia_api_survey_platform-0.0.9 test/mock_client_test.rb