File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
main/kotlin/com/stytch/java/common
test/kotlin/com/stytch/java/common Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ import com.stytch.java.b2b.models.rbac.Policy
77import com.stytch.java.b2b.models.rbac.PolicyRequest
88import com.stytch.java.b2b.models.rbac.PolicyRole
99import com.stytch.java.b2b.models.rbacorganizations.GetOrgPolicyRequest
10- import com.stytch.java.b2b.models.rbacorganizations.GetOrgPolicyResponse
1110import com.stytch.java.b2b.models.sessions.AuthorizationCheck
1211import kotlinx.coroutines.CoroutineScope
1312import kotlinx.coroutines.Job
@@ -83,7 +82,7 @@ internal class PolicyCache(
8382 private fun refreshOrgPolicy (orgId : String ) {
8483 val orgs = organizations ? : client.organizations
8584 when (val result = orgs.getOrgPolicyCompletable(GetOrgPolicyRequest (orgId)).get()) {
86- is StytchResult .Success < GetOrgPolicyResponse > -> {
85+ is StytchResult .Success -> {
8786 result.value.orgPolicy?.let { orgPolicy ->
8887 cachedOrgPolicies[orgId] = CachedOrgPolicy (orgPolicy, Instant .now())
8988 }
Original file line number Diff line number Diff line change @@ -255,6 +255,14 @@ internal class PolicyCacheTest {
255255 policy = policy,
256256 ),
257257 )
258+ every { organizations.getOrgPolicyCompletable(any()).get() } returns
259+ StytchResult .Success (
260+ GetOrgPolicyResponse (
261+ statusCode = 200 ,
262+ requestId = " " ,
263+ orgPolicy = OrgPolicy (roles = emptyList()),
264+ ),
265+ )
258266 }
259267
260268 val policyCache = PolicyCache (rbacMock, testScope)
@@ -289,6 +297,14 @@ internal class PolicyCacheTest {
289297 ),
290298 )
291299 }
300+ every { organizations.getOrgPolicyCompletable(any()).get() } returns
301+ StytchResult .Success (
302+ GetOrgPolicyResponse (
303+ statusCode = 200 ,
304+ requestId = " " ,
305+ orgPolicy = OrgPolicy (roles = emptyList()),
306+ ),
307+ )
292308 }
293309
294310 val policyCache = PolicyCache (rbacMock, testScope)
@@ -333,6 +349,14 @@ internal class PolicyCacheTest {
333349 policy = policy,
334350 ),
335351 )
352+ every { organizations.getOrgPolicyCompletable(any()).get() } returns
353+ StytchResult .Success (
354+ GetOrgPolicyResponse (
355+ statusCode = 200 ,
356+ requestId = " " ,
357+ orgPolicy = OrgPolicy (roles = emptyList()),
358+ ),
359+ )
336360 }
337361
338362 val policyCache = PolicyCache (rbacMock, testScope)
You can’t perform that action at this time.
0 commit comments