Sha256: 5264842aa036489f9442e3697d3cecb78cef2f82a64417e9e22aef26dcd89da1

Contents?: true

Size: 1014 Bytes

Versions: 18

Compression:

Stored size: 1014 Bytes

Contents

require 'helper'

class TestHttpUserAgent < Test::Unit::TestCase

  context "ntail" do
    
    should "correctly identify search bot user agent" do
      search_bot_user_agent = "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
      # directly via the helper function
      assert NginxTail::LogLine.search_bot?(search_bot_user_agent)
      # parsed from a raw log line
      log_line = random_log_line(:http_user_agent => search_bot_user_agent)
      assert log_line.search_bot?
      assert log_line.to_agent.search_bot?
    end

    should "correctly identify non-bot user agent" do
      non_bot_user_agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"
      # directly via the helper function
      assert !NginxTail::LogLine.search_bot?(non_bot_user_agent)
      # parsed from a raw log line
      log_line = random_log_line(:http_user_agent => non_bot_user_agent)
      assert !log_line.search_bot?
      assert !log_line.to_agent.search_bot?
    end
        
  end

end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
ntail-1.3.1 test/ntail/test_http_user_agent.rb
ntail-1.3.0 test/ntail/test_http_user_agent.rb
ntail-1.2.0 test/ntail/test_http_user_agent.rb
ntail-1.1.4 test/ntail/test_http_user_agent.rb
ntail-1.1.3 test/ntail/test_http_user_agent.rb
ntail-1.1.2 test/ntail/test_http_user_agent.rb
ntail-1.1.1 test/ntail/test_http_user_agent.rb
ntail-1.1.0 test/ntail/test_http_user_agent.rb
ntail-1.0.2 test/ntail/test_http_user_agent.rb
ntail-1.0.0 test/ntail/test_http_user_agent.rb
ntail-0.2.0 test/ntail/test_http_user_agent.rb
ntail-0.1.0 test/ntail/test_http_user_agent.rb
ntail-0.0.12 test/ntail/test_http_user_agent.rb
ntail-0.0.11 test/ntail/test_http_user_agent.rb
ntail-0.0.10 test/ntail/test_http_user_agent.rb
ntail-0.0.9 test/ntail/test_http_user_agent.rb
ntail-0.0.8 test/ntail/test_http_user_agent.rb
ntail-0.0.7 test/ntail/test_http_user_agent.rb