parent
513166847c
commit
b8478ea2c8
3 changed files with 31 additions and 4 deletions
@ -0,0 +1,20 @@ |
|||||||
|
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']) |
||||||
Loading…
Reference in new issue