core: use rest_framework in accounts
This commit is contained in:
@ -7,13 +7,11 @@ from django.contrib.auth.models import User
|
||||
|
||||
import uuid
|
||||
|
||||
from ..status_code import *
|
||||
|
||||
class DeleteTest(TestCase):
|
||||
def setUp(self):
|
||||
self.client = Client()
|
||||
|
||||
self.url = "/api/accounts/delete"
|
||||
self.url = "/accounts/delete"
|
||||
|
||||
self.username: str = str(uuid.uuid4())
|
||||
self.password: str = str(uuid.uuid4())
|
||||
@ -25,10 +23,10 @@ class DeleteTest(TestCase):
|
||||
def test_normal_delete(self):
|
||||
response: HttpResponse = self.client.post(self.url)
|
||||
response_text: str = response.content.decode("utf-8")
|
||||
self.assertEqual(response_text, USER_DELETED)
|
||||
self.assertEqual(response_text, '"user deleted"')
|
||||
|
||||
def test_no_logged(self):
|
||||
self.client.logout()
|
||||
response: HttpResponse = self.client.post(self.url)
|
||||
response_text: str = response.content.decode("utf-8")
|
||||
self.assertEqual(response_text, '')
|
||||
errors: dict = eval(response.content)
|
||||
self.assertDictEqual(errors, {"detail":"Authentication credentials were not provided."})
|
Reference in New Issue
Block a user