Coverage for polar/checkout_link/auth.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-07 12:42 +0000

1from typing import Annotated 

2 

3from fastapi import Depends 

4 

5from polar.auth.dependencies import Authenticator 

6from polar.auth.models import AuthSubject, User 

7from polar.auth.scope import Scope 

8from polar.models.organization import Organization 

9 

10_CheckoutLinkRead = Authenticator( 

11 required_scopes={ 

12 Scope.web_read, 

13 Scope.web_write, 

14 Scope.checkout_links_read, 

15 Scope.checkout_links_write, 

16 }, 

17 allowed_subjects={User, Organization}, 

18) 

19CheckoutLinkRead = Annotated[ 

20 AuthSubject[User | Organization], Depends(_CheckoutLinkRead) 

21] 

22 

23_CheckoutLinkWrite = Authenticator( 

24 required_scopes={ 

25 Scope.web_write, 

26 Scope.checkout_links_write, 

27 }, 

28 allowed_subjects={User, Organization}, 

29) 

30CheckoutLinkWrite = Annotated[ 

31 AuthSubject[User | Organization], Depends(_CheckoutLinkWrite) 

32]