MCPcopy Create free account

hub / github.com/0xjeffro/astroclaw / functions

Functions765 in github.com/0xjeffro/astroclaw

FunctionTestGetMe
(t *testing.T)
pkg/api/handlers_test.go:309
FunctionTestGetSession
(t *testing.T)
pkg/api/handlers_test.go:212
FunctionTestGetSessionInternalError
(t *testing.T)
pkg/api/handlers_test.go:235
FunctionTestGetSessionNotFound
(t *testing.T)
pkg/api/handlers_test.go:225
FunctionTestGetSystemSetting
(t *testing.T)
pkg/api/handlers_test.go:260
FunctionTestGetWorkspaceSetting
(t *testing.T)
pkg/api/handlers_test.go:273
FunctionTestIsContextLengthError
TestIsContextLengthError verifies detection of context-length errors from real API responses. Each test case is based on actual error strings from Ope
pkg/agent/context_test.go:669
FunctionTestIsObviousPrivateHost
Verify that isObviousPrivateHost catches common private hostnames.
pkg/tool/webfetch/ssrf_test.go:128
FunctionTestIsObviousPrivateHost_Public
Verify that public hostnames pass the pre-flight check.
pkg/tool/webfetch/ssrf_test.go:152
FunctionTestIsOverBudget_NoLimit
--------------------------------------------------------------------------- Budget check tests -------------------------------------------------------
pkg/agent/context_test.go:296
FunctionTestIsOverBudget_OverBudget
TestIsOverBudget_OverBudget verifies that a large history exceeding a small context window returns true. We use a tiny window (500 tokens) and fill hi
pkg/agent/context_test.go:325
FunctionTestIsOverBudget_SummaryCountedInBudget
TestIsOverBudget_SummaryCountedInBudget verifies that the summary field is included in the budget calculation. A large summary should push the total o
pkg/agent/context_test.go:341
FunctionTestIsOverBudget_UnderBudget
TestIsOverBudget_UnderBudget verifies that a small history within a generous context window returns false.
pkg/agent/context_test.go:310
FunctionTestIsPrivateOrRestrictedIP_IPv4MappedIPv6
Verify that IPv4-mapped IPv6 loopback is blocked.
pkg/tool/webfetch/ssrf_test.go:172
FunctionTestIsPrivateOrRestrictedIP_IPv4Private
Verify that common private IPv4 ranges are blocked.
pkg/tool/webfetch/ssrf_test.go:9
FunctionTestIsPrivateOrRestrictedIP_IPv4Public
Verify that public IPv4 addresses are allowed.
pkg/tool/webfetch/ssrf_test.go:43
FunctionTestIsPrivateOrRestrictedIP_IPv6
Verify that IPv6 private/restricted addresses are blocked.
pkg/tool/webfetch/ssrf_test.go:71
FunctionTestIsPrivateOrRestrictedIP_IPv6Public
Verify that public IPv6 addresses are allowed.
pkg/tool/webfetch/ssrf_test.go:98
FunctionTestIsPrivateOrRestrictedIP_Nil
Verify that nil IP is treated as restricted.
pkg/tool/webfetch/ssrf_test.go:121
FunctionTestListSessions
(t *testing.T)
pkg/api/handlers_test.go:191
FunctionTestListUserWorkspaces
ListUserWorkspaces decodes the JSON array correctly and preserves order.
pkg/client/client_test.go:134
FunctionTestListUserWorkspaces
(t *testing.T)
pkg/api/handlers_test.go:326
FunctionTestLoginBadBody
Malformed JSON body is a 400 before we ever talk to the service.
pkg/api/auth_test.go:92
FunctionTestLoginInvalidCredentials
Wrong credentials produce ErrInvalidCredentials, not ErrUnauthorized, so the CLI can distinguish "wrong password" from "stale token".
pkg/client/client_test.go:89
FunctionTestLoginInvalidCredentials
Wrong credentials surface as 401 with a generic message; no token is issued and the response says nothing about which field was wrong.
pkg/api/auth_test.go:70
FunctionTestLoginMissingFields
Missing email or password is a 400 with a distinct message.
pkg/api/auth_test.go:110
FunctionTestLoginSecretLoadError
Secret loader failure after a successful password check is a 500: the client did everything right, the server cannot finish the job.
pkg/api/auth_test.go:133
FunctionTestLoginValid
--- tests --- Happy path: Login returns a token, stores it internally, and decodes the user record correctly.
pkg/client/client_test.go:67
FunctionTestLoginValid
Happy path: valid credentials produce a token that parses back to the same user, plus a JSON body with token + user.
pkg/api/auth_test.go:23
FunctionTestLooksLikeHTML
Verify that looksLikeHTML correctly detects HTML content.
pkg/tool/webfetch/webfetch_test.go:71
FunctionTestMain
(m *testing.M)
deploy/aws/lambda/migrate/main_test.go:23
FunctionTestMain
(m *testing.M)
pkg/cloud/wsbus/inprocess/inprocess_test.go:32
FunctionTestMain
(m *testing.M)
pkg/app/chat/service_test.go:24
FunctionTestMain
TestMain lets the test binary impersonate the astroclaw CLI when testscript exec's "astroclaw <args>" from a .txtar script. When run normally, it fall
cmd/astroclaw/cli_test.go:14
FunctionTestMemorySave_BadJSON
Verifies that bad JSON arguments return an error.
pkg/tool/memory_test.go:62
FunctionTestMemorySave_EmptyContent
Verifies that empty content returns an error.
pkg/tool/memory_test.go:48
FunctionTestMemorySave_StoreError
Verifies that store errors propagate to the caller.
pkg/tool/memory_test.go:76
FunctionTestMemorySave_Success
Verifies that a valid memory is saved and the tool returns success.
pkg/tool/memory_test.go:31
FunctionTestMethodNotAllowed
(t *testing.T)
pkg/api/handlers_test.go:339
FunctionTestOpenAIChatStream
OPENAI_API_KEY=sk-xxx go test ./pkg/provider/ -v -run TestOpenAIChatStream
pkg/provider/openai_test.go:10
FunctionTestOpenAIChatSync
OPENAI_API_KEY=sk-xxx go test ./pkg/provider/ -v -run TestOpenAIChatSync
pkg/provider/openai_test.go:43
FunctionTestParseDDGResults
Test HTML parsing with a snapshot of DuckDuckGo's HTML structure. If DuckDuckGo changes their HTML, update this snapshot and the regexes.
pkg/tool/websearch/ddg_test.go:10
FunctionTestParseDDGResults_Count
Verify that the count parameter limits how many results are returned.
pkg/tool/websearch/ddg_test.go:79
FunctionTestParseDDGResults_Empty
Verify that HTML with no matching result elements returns an empty slice.
pkg/tool/websearch/ddg_test.go:71
FunctionTestParseExpired
Expired token: Parse must surface ErrTokenExpired specifically, so the middleware can distinguish "log in again" from "this token was always bad".
pkg/auth/jwt_test.go:59
FunctionTestParseRejectsAlgNone
alg=none attack: an attacker crafts a token with no signature. Parse must refuse it; otherwise anyone could forge claims. This is the canonical JWT vu
pkg/auth/jwt_test.go:78
FunctionTestParseRejectsTamperedPayload
Tampered payload: flip a byte in the middle base64 segment. The signature won't match the modified payload and Parse must reject.
pkg/auth/jwt_test.go:114
FunctionTestParseRejectsWrongSecret
Wrong secret: Parse with a different secret must fail because the HMAC signature won't match. Catches "someone reused a key they shouldn't have".
pkg/auth/jwt_test.go:100
FunctionTestParseTurnBoundaries_Empty
TestParseTurnBoundaries_Empty verifies that an empty history produces no boundaries.
pkg/agent/context_test.go:201
FunctionTestParseTurnBoundaries_SimpleConversation
--------------------------------------------------------------------------- Turn boundary tests ------------------------------------------------------
pkg/agent/context_test.go:154
FunctionTestParseTurnBoundaries_SingleUser
TestParseTurnBoundaries_SingleUser verifies a history with just one user message produces exactly one boundary.
pkg/agent/context_test.go:210
FunctionTestParseTurnBoundaries_WithToolCalls
TestParseTurnBoundaries_WithToolCalls verifies that tool_call and tool_result messages do NOT create new boundaries. They belong to the same Turn as t
pkg/agent/context_test.go:178
FunctionTestProtectedRouteExpiredToken
Expired tokens are rejected even though the signature is valid.
pkg/api/handlers_test.go:366
FunctionTestProtectedRouteNoToken
Protected routes require a bearer token. Without one, the auth middleware should reject the request with 401 before any service is called.
pkg/api/handlers_test.go:352
FunctionTestPushRoundTrip
TestPushRoundup proves the full round trip: client upgrades against the Handler, Registry.GetByUser (real DB row) surfaces the connID, Bus.Send writes
pkg/cloud/wsbus/inprocess/inprocess_test.go:80
FunctionTestReadFile_BadJSON
TestReadFile_BadJSON verifies that malformed JSON arguments return an error rather than panicking.
pkg/tool/readfile_test.go:175
FunctionTestReadFile_BinaryFile
TestReadFile_BinaryFile verifies that files containing null bytes are rejected with an error. Binary files (executables, images, etc.) would produce g
pkg/tool/readfile_test.go:159
FunctionTestReadFile_EmptyFile
TestReadFile_EmptyFile verifies that an empty file returns an empty string without error. This is a valid case — the model should see "" and can tell
pkg/tool/readfile_test.go:39
FunctionTestReadFile_LongLineTruncation
Verify that individual lines exceeding 2000 characters are truncated with a suffix, while the rest of the file is returned normally.
pkg/tool/readfile_test.go:126
FunctionTestReadFile_NormalText
TestReadFile_NormalText verifies the happy path: a small text file is read in full, with contents returned exactly as written.
pkg/tool/readfile_test.go:23
FunctionTestReadFile_NotFound
TestReadFile_NotFound verifies that a non-existent file returns an error containing the file path, so the model can tell the user which file was not f
pkg/tool/readfile_test.go:55
FunctionTestReadFile_Truncation
TestReadFile_Truncation verifies that files exceeding 2000 lines are truncated and the result ends with a [TRUNCATED] marker. This prevents a single l
pkg/tool/readfile_test.go:69
FunctionTestReadFile_TruncationByBytes
Verify that a file with few lines but exceeding 50KB is truncated at the byte limit, not the line limit.
pkg/tool/readfile_test.go:99
FunctionTestRejectsShortSecret
Short secrets are refused by both Sign and Parse so a misconfigured deployment can't silently produce weak HMACs.
pkg/auth/jwt_test.go:135
FunctionTestRejectsWrongKeyLength
(t *testing.T)
pkg/crypto/aes_test.go:58
FunctionTestReply_InvalidSession
TestReply_InvalidSession verifies that Reply with a non-existent session returns an error.
pkg/app/chat/service_test.go:223
FunctionTestReply_PersistsMessages
TestReply_PersistsMessages verifies that Reply saves both the user message and assistant reply to the database.
pkg/app/chat/service_test.go:139
FunctionTestReply_RestoresContext
TestReply_RestoresContext verifies that context is correctly restored when creating a new Agent from a session with existing ContextMessages.
pkg/app/chat/service_test.go:185
FunctionTestReply_SavesContext
TestReply_SavesContext verifies that after Reply, the session's ContextMessages are updated, so the next Reply can restore Agent state.
pkg/app/chat/service_test.go:160
FunctionTestRequireAuthExpired
Expired token: 401 with "token expired" so the client can distinguish "log in again" from "this token was always bad".
pkg/auth/middleware_test.go:130
FunctionTestRequireAuthInvalid
Tampered payload: signature won't verify, falls into the generic invalid bucket.
pkg/auth/middleware_test.go:154
FunctionTestRequireAuthMissingHeader
No Authorization header at all: 401 and next must not run.
pkg/auth/middleware_test.go:88
FunctionTestRequireAuthSecretLoadError
Secret loader failure: 500 (server fault, not client fault) and next must not run.
pkg/auth/middleware_test.go:181
FunctionTestRequireAuthValid
Happy path: a valid token passes through and the handler sees the claims.
pkg/auth/middleware_test.go:65
FunctionTestRequireAuthWrongScheme
Non-Bearer scheme is rejected with the same 401.
pkg/auth/middleware_test.go:108
FunctionTestRunMigrations_SchemaMatchesDirect
Verifies that runMigrations() produces the same schema as executing migration SQL files directly. Compares columns (name, type, nullable, default), in
deploy/aws/lambda/migrate/main_test.go:238
FunctionTestRunMigrations_SecondRun
Double check: run runMigrations() again on an already-migrated database. Statements should be skipped via the tracking table, or if tracking fails, ca
deploy/aws/lambda/migrate/main_test.go:311
FunctionTestRunMigrations_TrackingRecords
Verifies that the _migrations tracking table has the correct number of records (one per statement in the migration files).
deploy/aws/lambda/migrate/main_test.go:339
FunctionTestScripts
TestScripts runs every .txtar in testdata/scripts/ against a real deployed backend. URLs and admin password come from ASTROCLAW_API_URL, ASTROCLAW_REP
cmd/astroclaw/cli_test.go:28
FunctionTestSendMissingConn
TestSendMissingConn checks the ErrConnGone signal that the reply pipeline uses to unregister stale connections. This one needs no Registry — Bus alone
pkg/cloud/wsbus/inprocess/inprocess_test.go:133
FunctionTestSignParseRoundTrip
Round-trip: a token produced by Sign must Parse back into the same logical claims. Times are compared with truncation to one second since JWT encodes
pkg/auth/jwt_test.go:31
FunctionTestSplitStatements_CommentBeforeSQL
Verifies that comments preceding a SQL statement are preserved as part of the statement, not stripped or treated as a separate block.
deploy/aws/lambda/migrate/main_test.go:397
FunctionTestSplitStatements_CommentOnlyBlock
Verifies that comment-only blocks (no actual SQL) are filtered out. Atlas may prepend directives like "-- atlas:txmode none" that should not be treate
deploy/aws/lambda/migrate/main_test.go:383
FunctionTestSplitStatements_EmptyInput
Verifies that an empty input returns an empty slice, not nil or panic.
deploy/aws/lambda/migrate/main_test.go:422
FunctionTestSplitStatements_MultipleStatements
--- Unit tests for splitStatements --- Verifies that multiple DDL statements separated by semicolons are correctly split into individual statements.
deploy/aws/lambda/migrate/main_test.go:366
FunctionTestSplitStatements_SingleStatement
Verifies that a single statement without any extras is returned as-is.
deploy/aws/lambda/migrate/main_test.go:430
FunctionTestSplitStatements_TrailingSemicolon
Verifies that a trailing semicolon at the end of the file does not produce an extra empty statement.
deploy/aws/lambda/migrate/main_test.go:410
FunctionTestStrictDecoding
(t *testing.T)
pkg/crypto/password_test.go:221
FunctionTestStripHTML
Verify that stripHTML removes tags and normalizes whitespace.
pkg/tool/websearch/ddg_test.go:148
FunctionTestSummarizeOldTurns_AppendsToExistingSummary
TestSummarizeOldTurns_AppendsToExistingSummary verifies that new summaries are appended to existing ones, preserving earlier context.
pkg/agent/context_test.go:619
FunctionTestSummarizeOldTurns_Basic
--------------------------------------------------------------------------- LLM summarization tests --------------------------------------------------
pkg/agent/context_test.go:502
FunctionTestSummarizeOldTurns_IncludesToolResults
TestSummarizeOldTurns_IncludesToolResults verifies that small tool results are included in the summarization input, not filtered out.
pkg/agent/context_test.go:537
FunctionTestSummarizeOldTurns_LLMFailure
TestSummarizeOldTurns_LLMFailure verifies that when the LLM fails, the fallback summary is used instead. History is still truncated.
pkg/agent/context_test.go:589
FunctionTestSummarizeOldTurns_TooFewMessages
TestSummarizeOldTurns_TooFewMessages verifies that summarization is skipped when history has 4 or fewer messages.
pkg/agent/context_test.go:567
FunctionTestTruncateBytes
Verify that truncateBytes respects UTF-8 character boundaries when truncating at the byte limit.
pkg/tool/webfetch/webfetch_test.go:163
FunctionTestTruncateBytes_NoTruncation
Verify that truncateBytes returns the original string when under the limit.
pkg/tool/webfetch/webfetch_test.go:187
FunctionTestUpsertWorkspaceSetting
(t *testing.T)
pkg/api/handlers_test.go:286
FunctionTestUserIDFromContextMissing
(t *testing.T)
pkg/auth/middleware_test.go:210
FunctionTestVariant
(t *testing.T)
pkg/crypto/password_test.go:241
FunctionTestWriteFile_BadJSON
TestWriteFile_BadJSON verifies that malformed JSON arguments return an error rather than panicking.
pkg/tool/writefile_test.go:100
← previousnext →601–700 of 765, ranked by callers