File tree Expand file tree Collapse file tree 5 files changed +36
-2
lines changed Expand file tree Collapse file tree 5 files changed +36
-2
lines changed Original file line number Diff line number Diff line change 1313
1414import  os , random , string 
1515from  dotenv  import  load_dotenv 
16- from  ms_identity_python .
django  import  Auth    # pip install "ms_identity_python[django] @ git+https://github.com/azure-samples/[email protected] " 16+ from  identity .django  import  Auth 
1717load_dotenv ()
1818AUTH  =  Auth (
1919    os .getenv ('CLIENT_ID' ),
Original file line number Diff line number Diff line change 1- ms_identity_python [django ] @ git+ https://github.com/azure-samples/ms-identity-python@0.8 
1+ ms_identity_python [django ] @ https://github.com/azure-samples/ms-identity-python/archive/refs/heads/0.9.zip  
22python-dotenv < 0.22 
33requests >= 2 ,< 3 
Original file line number Diff line number Diff line change 1+ from  django .test  import  TestCase 
2+ from  django .template .exceptions  import  TemplateDoesNotExist 
3+ 
4+ 
5+ class  TemplateAccessibilityTest (TestCase ):
6+     def  test_login_attempt_should_render_its_template (self ):
7+         try :
8+             response  =  self .client .get ("/" )  # It will trigger the login attempt 
9+             print (response .content )
10+             # The response could be rendered by login.html if .env is complete, 
11+             # or by auth_error.html otherwise. 
12+             # I haven't figured out how to mock the .env to test it decisively. 
13+         except  TemplateDoesNotExist :
14+             self .fail (
15+                 "Template should be accessible, " 
16+                 "typically came from inside the Identity package." )
17+ 
Original file line number Diff line number Diff line change 1+ [tox] 
2+ env_list  =
3+     py3
4+ minversion  = 4.21.2
5+ 
6+ [testenv] 
7+ description  = run the tests with pytest
8+ package  = wheel
9+ wheel_build_env  = .pkg
10+ deps  =
11+     pytest>=6
12+     -r requirements.txt
13+ skip_install  = true  #  To bypass the error "Multiple top-level packages discovered"
14+ commands  =
15+     pip list
16+     python manage.py test
17+ 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments