require_relative '../test_helper'
require 'json'

class ProductTest < ActiveSupport::TestCase
  fixtures :all

  def test_indexed_fixture
    # check that fixtures got indexed
    Backend::Test.start

    assert_equal 1, Product.count
    p = Product.find_by_name('fixed')
    assert_equal 'fixed', p.name
    assert_equal 'BaseDistro', p.package.project.name
    assert_equal 'cpe:/o:obs_fuzzies:fixed:1.2', p.cpe

    m = ProductMedium.where(product: p).first
    assert_equal 'DVD', m.name
  end
end
