Sha256: d940d110fa53a4caf298217b01881daf03f16d84745b57ea38a3cf25efd5e139

Contents?: true

Size: 1.14 KB

Versions: 31

Compression:

Stored size: 1.14 KB

Contents

require 'test_helper'

class ReportTest < Test::Unit::TestCase
  test 'get should get a report' do
    fake 'reports/987', method: :get, status: 200, body: load_fixture('report')

    report = ShopifyAPI::Report.find(987)
    assert_equal 987, report.id
  end

  test 'get all should get all reports' do
    fake 'reports', method: :get, status: 200, body: load_fixture('reports')

    reports = ShopifyAPI::Report.all
    assert_equal 'custom_app_reports', reports.first.category
  end

  test 'create should create a report' do
    fake 'reports', method: :post, status: 201, body: load_fixture('report')

    report = ShopifyAPI::Report.create(
      name: 'Custom App Report',
      shopify_ql: 'SHOW quantity_count, total_sales BY product_type, vendor, product_title FROM products SINCE -1m UNTIL -0m ORDER BY total_sales DESC'
    )
    assert_equal 'custom_app_reports', report.category
  end

  test 'delete should delete report' do
    fake 'reports/987', method: :get, status: 200, body: load_fixture('report')
    fake 'reports/987', method: :delete, status: 200, body: '[]'

    report = ShopifyAPI::Report.find(987)
    assert report.destroy
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
shopify_api-9.2.0 test/report_test.rb
shopify_api-9.1.0 test/report_test.rb
shopify_api-9.0.4 test/report_test.rb
shopify_api-9.0.3 test/report_test.rb
shopify_api-9.0.2 test/report_test.rb
shopify_api-9.0.1 test/report_test.rb
shopify_api-9.0.0 test/report_test.rb
shopify_api-8.1.0 test/report_test.rb
shopify_api-8.0.0 test/report_test.rb
shopify_api-7.1.0 test/report_test.rb
shopify_api-7.0.2 test/report_test.rb
shopify_api-7.0.1 test/report_test.rb
shopify_api-7.0.0 test/report_test.rb
shopify_api-6.0.0 test/report_test.rb
shopify_api-5.2.4 test/report_test.rb
shopify_api-5.2.3 test/report_test.rb
shopify_api-5.2.2 test/report_test.rb
shopify_api-5.2.1 test/report_test.rb
shopify_api-5.2.0 test/report_test.rb
shopify_api-5.1.0 test/report_test.rb