You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

20 lines
548 B

from django.test import TestCase, Client
from django.contrib.auth import get_user_model
from django.urls import reverse
User = get_user_model()
class LogoutTest(TestCase):
def setUp(self):
self.url = reverse("lilcity:logout")
self.user = User.objects.create(username='Alice', password='1234')
self.client = Client()
def test_logout(self):
self.client.login(username=self.user.username, password='1234')
response = self.client.post(self.url)
self.assertTrue(response.json()['success'])