<commit_before>require File.expand_path('../helper', __FILE__)

class HonbuTest < Service::TestCase
  include Service::HttpTestMethods

  def test_push
    test_token = "<KEY>"


    data = {
      'token' => test_token,
    }

    payload = {'commits'=>[{'id'=>'test'}]}
    svc = service(data, payload)

    @stubs.post "/#{svc.delivery_guid}" do |env|
      body = JSON.parse(env[:body])

      assert_equal env[:url].host, "app.honbu.io/api"
      assert_equal env[:request_headers]['Authorization'], "Token #{test_token}"
      assert_equal 'test', body['payload']['commits'][0]['id']
      assert_match 'guid-', body['guid']
      assert_equal data, body['config']
      assert_equal 'push', body['event']
      [200, {}, '']
    end

    svc.receive_event
    @stubs.verify_stubbed_calls<commit_msg>minor URL edits<commit_after>require File.expand_path('../helper', __FILE__)

class HonbuTest < Service::TestCase
  include Service::HttpTestMethods

  def test_push
    test_token = "<KEY>"


    data = {
      'token' => test_token,
    }

    payload = {'commits'=>[{'id'=>'test'}]}
    svc = service(data, payload)

    @stubs.post "/" do |env|
      body = JSON.parse(env[:body])

      assert_equal env[:url].host, "https://app.honbu.io/api/integrations/github"
      assert_equal env[:request_headers]['Authorization'], "#{test_token}"
      assert_equal 'test', body['payload']['commits'][0]['id']
      assert_match 'guid-', body['guid']
      assert_equal data, body['config']
      assert_equal 'push', body['event']
      [200, {}, '']
    end

    svc.receive_event
    @stubs.verify_stubbed_calls
{'fraction_non_alphanumeric': 0.17388613861386137, 'fraction_numerical': 0.0049504950495049506, 'mean_word_length': 3.5294117647058822, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 1, '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': '6568685', 'n_tokens_mistral': 539, 'n_tokens_neox': 530, 'n_words': 97}