Tests: internal/credential
internal/credential · 9 tests
Each test is named for the property it holds, and runs against a real deployment: there is no mock of the database and no arm that skips when it is absent. The sentence is the test's name read back; the name is what go test -run takes.
access_test.go
- Read only credential resolves without acquiring write authority —
TestReadOnlyCredentialResolvesWithoutAcquiringWriteAuthority
credential_test.go
- A credential resolves to its projects and nothing else —
TestACredentialResolvesToItsProjectsAndNothingElse. A credential resolves to the projects it was granted, and carries nothing else. - A credential without a project is refused —
TestACredentialWithoutAProjectIsRefused. A credential with no project is refused at minting rather than issued and useless. - Every way of failing to resolve gives the same answer —
TestEveryWayOfFailingToResolveGivesTheSameAnswer. Absent, malformed, unknown and revoked are one answer, because telling them apart tells a stranger whether a token they hold is real. - The token is not recoverable from the database —
TestTheTokenIsNotRecoverableFromTheDatabase. The token is returned once and is not recoverable from what is stored. - The memory service cannot read a credential —
TestTheMemoryServiceCannotReadACredential. ── The structural claim ────────────────────────────────────────────────────────────────────── The memory service cannot read a credential. - Revoking an unknown or already revoked credential is refused —
TestRevokingAnUnknownOrAlreadyRevokedCredentialIsRefused. Revoking something that is not there, or is already revoked, is refused with the same answer as resolving one. - A credential without a name is refused —
TestACredentialWithoutANameIsRefused. A credential has to be nameable, because a list of anonymous keys is a list nobody can safely revoke from. - A credential opens one door by its kind and the registry holds the kind —
TestACredentialOpensOneDoorByItsKindAndTheRegistryHoldsTheKind. A credential is one of two kinds, and each kind opens one door: the memory resolver refuses an operator credential and the operator resolver refuses a project credential, both with the answer a stranger gets; an operator credential names no project; and the registry refuses a row that is both or neither.