mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 01:47:59 +03:00 
			
		
		
		
	Increase test coverage for drf_create_token command (#5550)
This commit is contained in:
		
							parent
							
								
									3ddc22f708
								
							
						
					
					
						commit
						5d71d8d4b8
					
				| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
import pytest
 | 
			
		||||
from django.contrib.admin import site
 | 
			
		||||
from django.contrib.auth.models import User
 | 
			
		||||
from django.core.management import call_command
 | 
			
		||||
from django.core.management import CommandError, call_command
 | 
			
		||||
from django.test import TestCase
 | 
			
		||||
from django.utils.six import StringIO
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -71,6 +71,11 @@ class AuthTokenCommandTests(TestCase):
 | 
			
		|||
 | 
			
		||||
        assert first_token_key == second_token_key
 | 
			
		||||
 | 
			
		||||
    def test_command_raising_error_for_invalid_user(self):
 | 
			
		||||
        out = StringIO()
 | 
			
		||||
        with pytest.raises(CommandError):
 | 
			
		||||
            call_command('drf_create_token', 'not_existing_user', stdout=out)
 | 
			
		||||
 | 
			
		||||
    def test_command_output(self):
 | 
			
		||||
        out = StringIO()
 | 
			
		||||
        call_command('drf_create_token', self.user.username, stdout=out)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user