add: delete and edit accounts page

This commit is contained in:
2023-12-01 01:29:56 +01:00
parent c2b6dbb989
commit 25f315c24f
12 changed files with 232 additions and 23 deletions

View File

@ -1,4 +1,5 @@
from .register import *
from .login import *
from .logout import *
from .edit import *
from .delete import *

View File

@ -21,12 +21,17 @@ class DeleteTest(TestCase):
def test_normal_delete(self):
response: HttpResponse = self.client.delete(self.url)
response: HttpResponse = self.client.delete(self.url, {"password": self.password}, content_type='application/json')
response_text: str = response.content.decode("utf-8")
self.assertEqual(response_text, '"user deleted"')
def test_wrong_pass(self):
response: HttpResponse = self.client.delete(self.url, {"password": "cacaman a frapper"}, content_type='application/json')
errors: dict = eval(response.content)
self.assertDictEqual(errors, {"password": ["Password wrong."]})
def test_no_logged(self):
self.client.logout()
response: HttpResponse = self.client.post(self.url)
response: HttpResponse = self.client.delete(self.url, {"password": self.password}, content_type='application/json')
errors: dict = eval(response.content)
self.assertDictEqual(errors, {"detail":"Authentication credentials were not provided."})