<commit_before>describe GraylogAPI::System::Inputs, vcr: true do
  include_context 'graylogapi'

  context 'create input' do
    subject(:response) do
      options = { title: 'Test_create_input',
                  type: 'org.graylog.plugins.beats.BeatsInput',
                  global: true,
                  configuration: { bind_address: '0.0.0.0',
                                   port: 5044,
                                   recv_buffer_size: 1_048_576,
                                   tls_client_auth: 'disabled' } }
      graylogapi.system.inputs.create(options)
    end

    it 'code 201' do
      expect(response.code).to eq 201
    end

    it 'return id' do
      expect(response.body.keys).to contain_exactly 'id'
    end
  end

  context 'update input' do
    subject(:response) do
      options = { title: 'Input by gem123',
                  type: 'org.graylog.plugins.beats.BeatsInput',
                  global: true,
                  configuration: { bind_address: '0.0.0.0',
                                   port: 5044 } }

      input = graylogapi.system.inputs.create(options)
      graylogapi.system.inputs.update(input.body['id'], options)
    end

    it 'code 201' do
      expect(response.code).to eq 201
    end

    it 'return id' do
      expect(response.body.keys).to contain_exactly 'id'
    end
  end

  context 'get all inputs' do
    subject(:response) { graylogapi.system.inputs.all }

    it 'code 200' do
      expect(response.code).to eq 200
    end

    it 'contain count of inputs' do
      expect(response.body.keys).to include 'total'
    end

    it 'contain array of inputs' do
      expect(response.body.keys).to include 'inputs'
    end
  end

  context 'get by id' do
    subject do
      options = { title: 'Input by gem123',
                  type: 'org.graylog.plugins.beats.BeatsInput',
                  global: true,
                  configuration: { bind_address: '0.0.0.0',
                                   port: 5044 } }

      input = graylogapi.system.inputs.create(options)
      graylogapi.system.inputs.by_id(input.body['id'])
    end

    it 'code 200' do
      expect(response.code).to eq 200
    end

    it 'contain id' do
      expect(response.body.keys).to include 'id'
    end

    it 'contain title' do
      expect(response.body.keys).to include 'title'
    end
  end
end<commit_msg>fix tests<commit_after>describe GraylogAPI::System::Inputs, vcr: true do
  include_context 'graylogapi'

  context 'create input' do
    subject(:response) do
      options = { title: 'Test_create_input',
                  type: 'org.graylog.plugins.beats.BeatsInput',
                  global: true,
                  configuration: { bind_address: '0.0.0.0',
                                   port: 5044,
                                   recv_buffer_size: 1_048_576,
                                   tls_client_auth: 'disabled' } }
      graylogapi.system.inputs.create(options)
    end

    it 'code 201' do
      expect(response.code).to eq 201
    end

    it 'return id' do
      expect(response.body.keys).to contain_exactly 'id'
    end
  end

  context 'update input' do
    subject(:response) do
      options = { title: 'Input by gem123',
                  type: 'org.graylog.plugins.beats.BeatsInput',
                  global: true,
                  configuration: { bind_address: '0.0.0.0',
                                   port: 5044 } }

      input = graylogapi.system.inputs.create(options)
      graylogapi.system.inputs.update(input.body['id'], options)
    end

    it 'code 201' do
      expect(response.code).to eq 201
    end

    it 'return id' do
      expect(response.body.keys).to contain_exactly 'id'
    end
  end

  context 'get all inputs' do
    subject(:response) { graylogapi.system.inputs.all }

    it 'code 200' do
      expect(response.code).to eq 200
    end

    it 'contain count of inputs' do
      expect(response.body.keys).to include 'total'
    end

    it 'contain array of inputs' do
      expect(response.body.keys).to include 'inputs'
    end
  end

  context 'get by id' do
    subject(:response) do
      options = { title: 'Input by gem123',
                  type: 'org.graylog.plugins.beats.BeatsInput',
                  global: true,
                  configuration: { bind_address: '0.0.0.0',
                                   port: 5044 } }

      input = graylogapi.system.inputs.create(options)
      graylogapi.system.inputs.by_id(input.body['id'])
    end

    it 'code 200' do
      expect(response.code).to eq 200
    end

    it 'contain id' do
      expect(response.body.keys).to include 'id'
    end

    it 'contain title' do
      expect(response.body.keys).to include 'title'
    end
  end
end
{'fraction_non_alphanumeric': 0.10145538915840539, 'fraction_numerical': 0.025732967728327356, 'mean_word_length': 1.7894117647058823, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3209649', 'n_tokens_mistral': 1539, 'n_tokens_neox': 1390, 'n_words': 354}