Пример #1
0
 def test_deletes_session_when_session_exists(self):
     user = User(
         username='******',
         password='******',
         salt='salt',
     ).save()
     Session(
         user=user,
         token='token',
     ).save()
     session = Session.objects.get(token='token')
     assert session is not None
     result = SessionService.delete_session_by_token('token')
     assert result is True
     with pytest.raises(Session.DoesNotExist):
         Session.objects.get(token='token')
Пример #2
0
 def test_fails_silently_when_session_does_not_exist(self):
     result = SessionService.delete_session_by_token('token')
     assert result is False
     with pytest.raises(Session.DoesNotExist):
         Session.objects.get(token='token')