@@ -79,3 +79,52 @@ def test_is_sms_verification_enabled(self):
7979 str (context_manager .exception ),
8080 "Could not complete operation because of an internal misconfiguration" ,
8181 )
82+
83+ @capture_any_output ()
84+ def test_cross_organization_login_enabled (self ):
85+ org = self ._create_org ()
86+ OrganizationRadiusSettings .objects .create (organization = org )
87+
88+ with self .subTest ("Test cross organization registration enabled set to True" ):
89+ org .radius_settings .cross_organization_login_enabled = True
90+ self .assertEqual (
91+ get_organization_radius_settings (
92+ org , "cross_organization_login_enabled"
93+ ),
94+ True ,
95+ )
96+
97+ with self .subTest ("Test cross organization registration enabled set to False" ):
98+ org .radius_settings .cross_organization_login_enabled = False
99+ self .assertEqual (
100+ get_organization_radius_settings (
101+ org , "cross_organization_login_enabled"
102+ ),
103+ False ,
104+ )
105+
106+ with self .subTest ("Test cross organization registration enabled set to None" ):
107+ org .radius_settings .cross_organization_login_enabled = None
108+ org .radius_settings .save (
109+ update_fields = ["cross_organization_login_enabled" ]
110+ )
111+ org .radius_settings .refresh_from_db (
112+ fields = ["cross_organization_login_enabled" ]
113+ )
114+ self .assertEqual (
115+ get_organization_radius_settings (
116+ org , "cross_organization_login_enabled"
117+ ),
118+ app_settings .CROSS_ORGANIZATION_LOGIN_ENABLED ,
119+ )
120+
121+ with self .subTest ("Test related radius setting does not exist" ):
122+ org .radius_settings = None
123+ with self .assertRaises (APIException ) as context_manager :
124+ get_organization_radius_settings (
125+ org , "cross_organization_login_enabled"
126+ )
127+ self .assertEqual (
128+ str (context_manager .exception ),
129+ "Could not complete operation because of an internal misconfiguration" ,
130+ )
0 commit comments