File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 1
1
import pytest
2
2
from django .contrib .admin import site
3
3
from django .contrib .auth .models import User
4
- from django .core .management import call_command
4
+ from django .core .management import CommandError , call_command
5
5
from django .test import TestCase
6
6
from django .utils .six import StringIO
7
7
@@ -71,6 +71,11 @@ def test_command_do_not_reset_user_token(self):
71
71
72
72
assert first_token_key == second_token_key
73
73
74
+ def test_command_raising_error_for_invalid_user (self ):
75
+ out = StringIO ()
76
+ with pytest .raises (CommandError ):
77
+ call_command ('drf_create_token' , 'not_existing_user' , stdout = out )
78
+
74
79
def test_command_output (self ):
75
80
out = StringIO ()
76
81
call_command ('drf_create_token' , self .user .username , stdout = out )
You can’t perform that action at this time.
0 commit comments