@@ -805,6 +805,13 @@ def test_authentication_configuration() -> None:
805805 assert auth_config .k8s_ca_cert_path is None
806806 assert auth_config .k8s_cluster_api is None
807807
808+ # try to retrieve JWK configuration
809+ with pytest .raises (
810+ ValueError ,
811+ match = "JWK configuration is only available for JWK token authentication module" ,
812+ ):
813+ _ = auth_config .jwk_configuration
814+
808815
809816def test_authentication_configuration_jwk_token () -> None :
810817 """Test the AuthenticationConfiguration with JWK token."""
@@ -822,6 +829,9 @@ def test_authentication_configuration_jwk_token() -> None:
822829 assert auth_config .k8s_ca_cert_path is None
823830 assert auth_config .k8s_cluster_api is None
824831
832+ # try to retrieve JWK configuration
833+ assert auth_config .jwk_configuration is not None
834+
825835
826836def test_authentication_configuration_jwk_token_but_insufficient_config () -> None :
827837 """Test the AuthenticationConfiguration with JWK token."""
@@ -852,6 +862,26 @@ def test_authentication_configuration_jwk_token_but_not_config() -> None:
852862 )
853863
854864
865+ def test_authentication_configuration_jwk_broken_config () -> None :
866+ """Test the AuthenticationConfiguration with JWK set, but not configured."""
867+
868+ auth_config = AuthenticationConfiguration (
869+ module = AUTH_MOD_JWK_TOKEN ,
870+ skip_tls_verification = False ,
871+ k8s_ca_cert_path = None ,
872+ k8s_cluster_api = None ,
873+ jwk_config = JwkConfiguration (url = "http://foo.bar.baz" ),
874+ )
875+ assert auth_config is not None
876+
877+ # emulate broken config
878+ auth_config .jwk_config = None
879+ # try to retrieve JWK configuration
880+
881+ with pytest .raises (ValueError , match = "JWK configuration should not be None" ):
882+ _ = auth_config .jwk_configuration
883+
884+
855885def test_authentication_configuration_supported () -> None :
856886 """Test the AuthenticationConfiguration constructor."""
857887 auth_config = AuthenticationConfiguration (
@@ -893,7 +923,7 @@ def test_database_configuration(subtests) -> None:
893923 assert d .sqlite is None
894924 assert d .postgres is not None
895925 assert d .db_type == "postgres"
896- assert d .config == d1
926+ assert d .config is d1
897927
898928 with subtests .test (msg = "SQLite" ):
899929 d1 = SQLiteDatabaseConfiguration (
@@ -904,7 +934,7 @@ def test_database_configuration(subtests) -> None:
904934 assert d .sqlite is not None
905935 assert d .postgres is None
906936 assert d .db_type == "sqlite"
907- assert d .config == d1
937+ assert d .config is d1
908938
909939
910940def test_no_databases_configuration () -> None :
@@ -920,11 +950,11 @@ def test_no_databases_configuration() -> None:
920950 d .postgres = None
921951
922952 with pytest .raises (ValueError , match = "No database configuration found" ):
923- # access propery to call it's getter
953+ # access propery to call its getter
924954 _ = d .db_type
925955
926956 with pytest .raises (ValueError , match = "No database configuration found" ):
927- # access propery to call it's getter
957+ # access propery to call its getter
928958 _ = d .config
929959
930960
0 commit comments