<commit_before>require 'test_helper'

module Autotune
  # Test project api
  class ProjectsControllerTest < ActionController::TestCase
    fixtures 'autotune/blueprints', 'autotune/projects', 'autotune/themes', 'autotune/users', 'autotune/groups'
    test 'that listing projects requires authentication' do
      accept_json!

      get :index
      assert_response :unauthorized
      assert_equal({ 'error' => 'Unauthorized' }, decoded_response)
    end

    test 'listing projects' do
      accept_json!
      valid_auth_header!

      get :index
      assert_response :success
      assert_instance_of Array, decoded_response
      assert_equal Project.all.count, decoded_response.length
    end

    test 'listing projects as author' do
      accept_json!
      valid_auth_header! :author

      get :index
      assert_response :success<commit_msg>add group membership fixture to project controller test<commit_after>require 'test_helper'

module Autotune
  # Test project api
  class ProjectsControllerTest < ActionController::TestCase
    fixtures 'autotune/blueprints', 'autotune/projects', 'autotune/themes', 'autotune/users', 'autotune/groups', 'autotune/group_memberships'
    test 'that listing projects requires authentication' do
      accept_json!

      get :index
      assert_response :unauthorized
      assert_equal({ 'error' => 'Unauthorized' }, decoded_response)
    end

    test 'listing projects' do
      accept_json!
      valid_auth_header!

      get :index
      assert_response :success
      assert_instance_of Array, decoded_response
      assert_equal Project.all.count, decoded_response.length
    end

    test 'listing projects as author' do
      accept_json!
      valid_auth_header! :author

      get :index
      assert_response :success
{'fraction_non_alphanumeric': 0.07191011235955057, 'fraction_numerical': 0.0, 'mean_word_length': 3.520304568527919, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4622752', 'n_tokens_mistral': 507, 'n_tokens_neox': 481, 'n_words': 133}