File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
dakara_server/playlist/tests Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,23 @@ def test_get(self):
5858
5959 self .assertEqual (response .data ["karaoke_id" ], player_token .karaoke .id )
6060
61+ def test_get_not_found (self ):
62+ """Test to get a token that doesn't exist"""
63+ # login
64+ self .authenticate (self .manager )
65+
66+ # get the token
67+ url = reverse ("playlist-player-token" , kwargs = {"pk" : 99 })
68+ response = self .client .get (url )
69+ self .assertEqual (response .status_code , status .HTTP_404_NOT_FOUND )
70+
71+ # check the error
72+ self .assertNotIn ("karaoke_id" , response .data )
73+ self .assertIn ("detail" , response .data )
74+ detail = response .data ["detail" ]
75+ self .assertEqual (detail .code , "not_found" )
76+ self .assertEqual (str (detail ), "No PlayerToken matches the given query." )
77+
6178 def test_delete (self ):
6279 """Test to delete a token"""
6380 # get karaoke and token
You can’t perform that action at this time.
0 commit comments