#NEWLINE# def test_login( self ) : #NEWLINE# #INDENT# user = TestUsers . new_user ( username = 'lol' , password = 'lol' ) #NEWLINE# user2 = TestUsers . new_user ( username = 'bunny' , password = 'bunny' ) #NEWLINE# credentials = { #NEWLINE# #INDENT# 'username' : 'lol' , #NEWLINE# 'password' : 'lol' , #NEWLINE# #UNINDENT# } #NEWLINE# response = self . client . post ( self . url , data = json . dumps ( credentials ) , content_type = 'application/json' ) #NEWLINE# self . assertEqual ( response . status_code , 201 ) #NEWLINE# self . assertEqual ( int ( self . client . session [ '_auth_user_id' ] ) , user . id ) #NEWLINE# credentials = { #NEWLINE# #INDENT# 'username' : 'bunny' , #NEWLINE# 'password' : 'bunny' , #NEWLINE# #UNINDENT# } #NEWLINE# response = self . client . post ( self . url , data = json . dumps ( credentials ) , content_type = 'application/json' ) #NEWLINE# self . assertEqual ( int ( self . client . session [ '_auth_user_id' ] ) , user . id ) #NEWLINE# data = json . loads ( response . content ) #NEWLINE# self . assertEqual ( data [ 'detail' ] , 'Another user is currently logged in.' )