mirror of
https://github.com/gravitational/teleport.git
synced 2026-10-12 02:15:01 +00:00
* Move auth test helpers to authtest package In an effort to remove testing symbols from the teleport binary the auth helpers in lib/auth/helpers.go are being moved to a new lib/auth/authtest package. This package is to be limited to only being imported within _test.go files to prevent the helpers from slipping back into production code. * Convert lib/auth tests to use lib/auth/authtest All tests within lib/auth that made use of the test helpers in lib/auth/helpers.go now use the equivalent functionality provided by lib/auth/authtest. To prevent import cycles the tests in lib/auth have been moved to the auth_test package. This shift required some extra work as a fair number of the existing tests relied on unexported symbols. To work around this lib/auth/export_test.go has been added for the sole purpose of exporting private types, methods, or extending existing types with new exported received methods. This was chosen over rewriting existing tests for time and simplicity. All future tests should not rely on this hack and should instead stick to testing the publicly exported items from the auth package. * fix: allow specifying accepted usage in cert requests * fix: restore test assertions in TestGenerateKubernetesUserCert * fix: set remote cluster variables * fix: restore test assertions in TestGenerateUserCertWithHardwareKeySupport * fix: context passing to user cert generation * fix: github connector API * fix: pull renewable field from outer identity * rename authtest.TestDevice authtest.Device * fix: typos * add clean up TODOs * Refactor authtest helpers * fix: convert additions to bound keypair tests * fix: add plugin service to authtest helpers
31 lines
1.1 KiB
Go
31 lines
1.1 KiB
Go
// Teleport
|
|
// Copyright (C) 2025 Gravitational, Inc.
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Affero General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
package authz
|
|
|
|
// The items exported here exist solely to prevent import cycles and facilitate
|
|
// preexisting tests in lib/authz which relied on unexported items. All new
|
|
// tests in lib/authz should exist in the authz_test package and not rely on
|
|
// internal state.
|
|
|
|
func DisableContextDeviceRoleMode(ctx *Context) {
|
|
ctx.disableDeviceRoleMode = true
|
|
}
|
|
|
|
func ContextDeviceRoleMode(ctx *Context) bool {
|
|
return ctx.disableDeviceRoleMode
|
|
}
|