<commit_before>require_relative '../../test_helper'

class Admin::HomeCarouselSlidesControllerTest < ActionController::TestCase

  def setup
    # TODO: login as admin user
    @home_carousel_slide = FactoryGirl.create(:home_carousel_slide)
  end

  def test_get_index
    get :index
    assert_response :success
    assert assigns(:home_carousel_slides)
    assert_template :index
  end

  def test_get_show
    get :show, :id => @home_carousel_slide
    assert_response :success
    assert assigns(:home_carousel_slide)
    assert_template :show
  end

  def test_get_show_failure
    get :show, :id => 'invalid'
    assert_response :redirect
    assert_redirected_to :action => :index
    assert_equal 'Home Carousel Slide not found', flash[:danger]
  end<commit_msg>fix home carousel slide controller tests<commit_after>require_relative '../../test_helper'

class Admin::HomeCarouselSlidesControllerTest < ActionController::TestCase

  def setup
    @home_carousel_slide = FactoryGirl.create(:home_carousel_slide)
    @site = ::Comfy::Cms::Site.create(label: 'test', identifier: 'test', hostname: 'localhost')
    @request.env["HTTP_AUTHORIZATION"] = "Basic " + Base64::encode64("#{ComfortableMexicanSofa::AccessControl::AdminAuthentication.username}:#{ComfortableMexicanSofa::AccessControl::AdminAuthentication.password}")
  end

  def test_get_index
    get :index
    assert_response :success
    assert assigns(:home_carousel_slides)
    assert_template :index
  end

  def test_get_show
    get :show, :id => @home_carousel_slide
    assert_response :success
    assert assigns(:home_carousel_slide)
    assert_template :show
  end

  def test_get_show_failure
    get :show, :id => 'invalid'
    assert_response :redirect
    assert_redirected_to :action => :index
    assert_equal 'Home Carousel Slide not found', flash[:danger]
  end
{'fraction_non_alphanumeric': 0.09268292682926829, 'fraction_numerical': 0.002168021680216802, 'mean_word_length': 4.841772151898734, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5011221', 'n_tokens_mistral': 571, 'n_tokens_neox': 554, 'n_words': 125}