<commit_before>require 'spec_helper'

describe ZendeskAPI::Ticket do
  def valid_attributes
    {
      :type => "question",
      :subject => "This is a question?",
      :comment => { :value => "Indeed it is!" },
      :priority => "normal",
      :requester_id => user.id,
      :submitter_id => user.id
    }
  end

  it_should_be_creatable
  it_should_be_updatable :subject
  it_should_be_deletable
  it_should_be_readable :tickets
  it_should_be_readable :tickets, :recent
  it_should_be_readable user, :requested_tickets
  it_should_be_readable user, :ccd_tickets
  it_should_be_readable organization, :tickets

  describe ".incremental_export" do
    let(:results){ ZendeskAPI::Ticket.incremental_export(client, Time.at(1023059503)) } # ~ 10 years ago

    around do |example|
      # 1 request every 5 minutes allowed <-> you can only test 1 call ...
      VCR.use_cassette("incremental_export") do
        Timeout.timeout(5) do # fail if we get rate-limited
          example.call
        end
      end
    end<commit_msg>fix ccd_tickets live spec<commit_after>require 'spec_helper'

describe ZendeskAPI::Ticket do
  def valid_attributes
    {
      :type => "question",
      :subject => "This is a question?",
      :comment => { :value => "Indeed it is!" },
      :priority => "normal",
      :requester_id => user.id,
      :submitter_id => user.id,
      :collaborator_ids => [agent.id]
    }
  end

  it_should_be_creatable
  it_should_be_updatable :subject
  it_should_be_deletable
  it_should_be_readable :tickets
  it_should_be_readable :tickets, :recent
  it_should_be_readable user, :requested_tickets
  it_should_be_readable agent, :ccd_tickets
  it_should_be_readable organization, :tickets

  describe ".incremental_export" do
    let(:results){ ZendeskAPI::Ticket.incremental_export(client, Time.at(1023059503)) } # ~ 10 years ago

    around do |example|
      # 1 request every 5 minutes allowed <-> you can only test 1 call ...
      VCR.use_cassette("incremental_export") do
        Timeout.timeout(5) do # fail if we get rate-limited
          example.call
        end
      end
    end
{'fraction_non_alphanumeric': 0.09688090737240075, 'fraction_numerical': 0.015122873345935728, 'mean_word_length': 3.3381147540983607, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, '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': '70174', 'n_tokens_mistral': 743, 'n_tokens_neox': 684, 'n_words': 166}