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