docs: README, compose example, integration test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
15874f7ecb
commit
45f88378a6
4 files changed
+236
No files matched your search
@@ -0,0 +1,38 @@
|
||||
package signalbot
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
// TestIntegrationPingGroupsSend runs against a real, linked service:
|
||||
//
|
||||
// SIGNALBOT_IT_URL=http://localhost:8080 SIGNALBOT_IT_GROUP=group.… go test -run Integration -v
|
||||
func TestIntegrationPingGroupsSend(t *testing.T) {
|
||||
url, group := os.Getenv("SIGNALBOT_IT_URL"), os.Getenv("SIGNALBOT_IT_GROUP")
|
||||
if url == "" || group == "" {
|
||||
t.Skip("set SIGNALBOT_IT_URL and SIGNALBOT_IT_GROUP to run")
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
c := mustNew(t, url, WithNumber(os.Getenv("SIGNALBOT_IT_NUMBER")))
|
||||
if err := c.Ping(ctx); err != nil {
|
||||
t.Fatalf("Ping: %v", err)
|
||||
}
|
||||
groups, err := c.Groups(ctx)
|
||||
if err != nil {
|
||||
t.Fatalf("Groups: %v", err)
|
||||
}
|
||||
found := false
|
||||
for _, g := range groups {
|
||||
found = found || g.ID == group
|
||||
}
|
||||
if !found {
|
||||
t.Fatalf("group %s not in %+v", group, groups)
|
||||
}
|
||||
if err := c.Send(ctx, group, "signalbot integration test "+time.Now().Format(time.RFC3339)); err != nil {
|
||||
t.Fatalf("Send: %v", err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user