mirror of
				https://github.com/django/django.git
				synced 2025-10-26 07:06:08 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			16 lines
		
	
	
		
			530 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			530 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| import os
 | |
| from unittest import mock
 | |
| 
 | |
| from django.core.checks.async_checks import E001, check_async_unsafe
 | |
| from django.test import SimpleTestCase
 | |
| 
 | |
| 
 | |
| class AsyncCheckTests(SimpleTestCase):
 | |
|     @mock.patch.dict(os.environ, {"DJANGO_ALLOW_ASYNC_UNSAFE": ""})
 | |
|     def test_no_allowed_async_unsafe(self):
 | |
|         self.assertEqual(check_async_unsafe(None), [])
 | |
| 
 | |
|     @mock.patch.dict(os.environ, {"DJANGO_ALLOW_ASYNC_UNSAFE": "true"})
 | |
|     def test_allowed_async_unsafe_set(self):
 | |
|         self.assertEqual(check_async_unsafe(None), [E001])
 |