File tree 5 files changed +21
-13
lines changed
tests/test_planet_auth_utils/unit/auth_utils
5 files changed +21
-13
lines changed Original file line number Diff line number Diff line change 17
17
18
18
from planet_auth import AuthClientConfig
19
19
from planet_auth_utils .profile import ProfileException
20
- from planet_auth_utils .constants import EnvironmentVariables
21
20
from planet_auth .logging .auth_logger import getAuthLogger
22
- from .builtins_provider import BuiltinConfigurationProviderInterface , EmptyBuiltinProfileConstants
21
+ from .builtins_provider import (
22
+ BuiltinConfigurationProviderInterface ,
23
+ EmptyBuiltinProfileConstants ,
24
+ AUTH_BUILTIN_PROVIDER ,
25
+ )
23
26
24
27
auth_logger = getAuthLogger ()
25
28
@@ -61,7 +64,7 @@ def _load_builtins() -> BuiltinConfigurationProviderInterface:
61
64
# Undermining it can undermine client or service security.
62
65
# It is a convenience for seamless developer experience, but maybe
63
66
# we should not be so eager to please.
64
- builtin_provider = _load_builtins_worker (os .getenv (EnvironmentVariables . AUTH_BUILTIN_PROVIDER ))
67
+ builtin_provider = _load_builtins_worker (os .getenv (AUTH_BUILTIN_PROVIDER ))
65
68
if builtin_provider :
66
69
return builtin_provider
67
70
Original file line number Diff line number Diff line change 16
16
from typing import Dict , List , Optional
17
17
18
18
19
+ # Unlike other environment variables, AUTH_BUILTIN_PROVIDER is not name-spaced.
20
+ # It is intended for libraries and applications to inject configuration by
21
+ # being set within the program. It's not generally expected to be set by
22
+ # users.
23
+ AUTH_BUILTIN_PROVIDER = "PL_AUTH_BUILTIN_CONFIG_PROVIDER"
24
+ """
25
+ Specify a python module and class that implement the BuiltinConfigurationProviderInterface abstract
26
+ interface to provide the library and utility commands with some built-in configurations.
27
+ """
28
+
19
29
_NOOP_AUTH_CLIENT_CONFIG = {
20
30
"client_type" : "none" ,
21
31
}
Original file line number Diff line number Diff line change @@ -98,9 +98,3 @@ class EnvironmentVariables:
98
98
"""
99
99
Specify the log level.
100
100
"""
101
-
102
- AUTH_BUILTIN_PROVIDER = "PL_AUTH_BUILTIN_CONFIG_PROVIDER"
103
- """
104
- Specify a python module and class that implement the BuiltinConfigurationProviderInterface abstract
105
- interface to provide the library and utility commands with some built-in configurations.
106
- """
Original file line number Diff line number Diff line change 16
16
import pytest
17
17
import unittest
18
18
19
+ from planet_auth_utils .builtins_provider import AUTH_BUILTIN_PROVIDER
19
20
from planet_auth_utils .builtins import Builtins , BuiltinsException
20
- from planet_auth_utils .constants import EnvironmentVariables
21
21
22
22
from tests .test_planet_auth_utils .util import TestWithHomeDirProfiles
23
23
from tests .test_planet_auth_utils .unit .auth_utils .builtins_test_impl import BuiltinConfigurationProviderMockTestImpl
@@ -56,7 +56,7 @@ def test_builtin_all_profile_dicts_are_valid(self):
56
56
57
57
class TestAuthClientContextInitHelpers (TestWithHomeDirProfiles , unittest .TestCase ):
58
58
def setUp (self ):
59
- os .environ [EnvironmentVariables . AUTH_BUILTIN_PROVIDER ] = (
59
+ os .environ [AUTH_BUILTIN_PROVIDER ] = (
60
60
"tests.test_planet_auth_utils.unit.auth_utils.builtins_test_impl.BuiltinConfigurationProviderMockTestImpl"
61
61
)
62
62
Builtins ._builtin = None # Reset built-in state.
Original file line number Diff line number Diff line change 20
20
import planet_auth .storage_utils
21
21
from planet_auth .constants import AUTH_CONFIG_FILE_PLAIN
22
22
23
+ from planet_auth_utils .builtins_provider import AUTH_BUILTIN_PROVIDER
23
24
from planet_auth_utils .builtins import Builtins
24
25
from planet_auth_utils .constants import EnvironmentVariables
25
26
from planet_auth_utils .plauth_factory import PlanetAuthFactory , MissingArgumentException
37
38
38
39
class TestAuthClientContextInitHelpers (TestWithHomeDirProfiles , unittest .TestCase ):
39
40
def setUp (self ):
40
- os .environ [EnvironmentVariables . AUTH_BUILTIN_PROVIDER ] = (
41
+ os .environ [AUTH_BUILTIN_PROVIDER ] = (
41
42
"tests.test_planet_auth_utils.unit.auth_utils.builtins_test_impl.BuiltinConfigurationProviderMockTestImpl"
42
43
)
43
44
Builtins ._builtin = None # Reset built-in state.
@@ -391,7 +392,7 @@ def test_save_profile_does_not_save_when_false(self):
391
392
392
393
class TestResourceServerValidatorInitHelper (TestWithHomeDirProfiles , unittest .TestCase ):
393
394
def setUp (self ):
394
- os .environ [EnvironmentVariables . AUTH_BUILTIN_PROVIDER ] = (
395
+ os .environ [AUTH_BUILTIN_PROVIDER ] = (
395
396
"tests.test_planet_auth_utils.unit.auth_utils.builtins_test_impl.BuiltinConfigurationProviderMockTestImpl"
396
397
)
397
398
Builtins ._builtin = None # Reset built-in state.
You can’t perform that action at this time.
0 commit comments