(t *testing.T)
| 526 | } |
| 527 | |
| 528 | func TestGetInboundMessageExpired(t *testing.T) { |
| 529 | pool := testutil.TestDB(t) |
| 530 | store := identity.NewStore(pool) |
| 531 | ctx := context.Background() |
| 532 | |
| 533 | user, _ := store.CreateOrGetUser(ctx, "owner@example.com", "Owner", "google-expired-inbound") |
| 534 | store.ClaimOrCreateDomain(ctx, "expired-inbound.example.com", user.ID) |
| 535 | a, _ := store.CreateAgent(ctx, "agent@expired-inbound.example.com", "expired-inbound.example.com", "", "https://example.com/webhook", "", user.ID) |
| 536 | msg, _ := store.CreateInboundMessage(ctx, "", a.ID, "alice@gmail.com", "bot@expired-inbound.example.com", "", "", "", "", nil, nil, nil, false, "", nil, nil, nil, identity.InboundScreening{}) |
| 537 | |
| 538 | // Set expiry to the past |
| 539 | pool.Exec(ctx, `UPDATE messages SET expires_at = $1 WHERE id = $2`, time.Now().Add(-1*time.Hour), msg.ID) |
| 540 | |
| 541 | _, err := store.GetInboundMessage(ctx, msg.ID) |
| 542 | if err == nil { |
| 543 | t.Error("expected error for expired inbound message") |
| 544 | } |
| 545 | } |
| 546 | |
| 547 | func TestDeleteExpiredMessages(t *testing.T) { |
| 548 | pool := testutil.TestDB(t) |
nothing calls this directly
no test coverage detected