User session tracking #93587

Merged
Oleg-Komarov merged 18 commits from user-session into main 2024-08-02 16:04:09 +02:00
Showing only changes of commit f6ecf235a5 - Show all commits

View File

@ -0,0 +1,16 @@
from django.test import TestCase
from django.test.client import Client
from bid_main.tests.factories import UserFactory
class TestUserSessions(TestCase):
def test_records_created_and_delete(self):
user = UserFactory()
client1 = Client()
client2 = Client()
client1.force_login(user)
client2.force_login(user)
self.assertEqual(user.sessions.count(), 2)
client2.logout()
self.assertEqual(user.sessions.count(), 1)