Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F10387176
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
811 B
Subscribers
None
View Options
diff --git a/bots/bots_test.go b/bots/bots_test.go
new file mode 100644
index 0000000..82b15d1
--- /dev/null
+++ b/bots/bots_test.go
@@ -0,0 +1,19 @@
+package bots
+
+import "testing"
+
+func TestIsBot(t *testing.T) {
+ tests := map[string]bool{
+ "Twitterbot/1.0": true,
+ "http.rb/2.2.2 (Mastodon/1.6.0; +https://insolente.im/)": true,
+ "http.rb/2.2.2 (Mastodon/1.5.1; +https://mastodon.cloud/)": true,
+ "http.rb/2.2.2 (Mastodon/1.6.0rc5; +https://mastodon.sdf.org/)": true,
+ "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko": false,
+ }
+
+ for ua, r := range tests {
+ if IsBot(ua) != r {
+ t.Errorf("Expected bot = %t on '%s'", r, ua)
+ }
+ }
+}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Nov 25, 1:44 AM (1 d, 7 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3106491
Attached To
rWC Write.as Web Core
Event Timeline
Log In to Comment