From d92bb666522a0063990a4f02b69c14af15f1d042 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Sat, 9 Nov 2024 18:38:29 +0100 Subject: [PATCH] Fix tests --- .../core/tests/test_user_rest_registration.py | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/wger/core/tests/test_user_rest_registration.py b/wger/core/tests/test_user_rest_registration.py index 691a75151..28353c54b 100644 --- a/wger/core/tests/test_user_rest_registration.py +++ b/wger/core/tests/test_user_rest_registration.py @@ -69,7 +69,6 @@ def test_post_valid_api_user_creation(self): response = self.client.post( reverse('api_register'), {'username': 'restapi', 'email': 'abc@cde.fg', 'password': 'AekaiLe0ga'}, - Authorization=f'Token {token.key}', ) count_after = User.objects.count() self.assertEqual(response.status_code, HTTP_201_CREATED) @@ -91,7 +90,6 @@ def test_post_valid_api_user_creation_no_email(self): response = self.client.post( reverse('api_register'), {'username': 'restapi', 'password': 'AekaiLe0ga'}, - Authorization=f'Token {token.key}', ) count_after = User.objects.count() self.assertEqual(response.status_code, HTTP_201_CREATED) @@ -102,21 +100,6 @@ def test_post_valid_api_user_creation_no_email(self): self.assertEqual(response.data['token'], token.key) self.assertEqual(count_after, count_before + 1) - def test_post_not_allowed_api_user_creation(self): - """User admin isn't allowed to register users""" - - self.user_login('admin') - count_before = User.objects.count() - - response = self.client.post( - reverse('api_register'), - {'username': 'restapi', 'email': 'abc@cde.fg', 'password': 'AekaiLe0ga'}, - ) - count_after = User.objects.count() - - self.assertEqual(response.status_code, HTTP_403_FORBIDDEN) - self.assertEqual(count_after, count_before) - def test_post_unsuccessfully_registration_no_username(self): """Test unsuccessful registration (weak password)""" @@ -127,7 +110,6 @@ def test_post_unsuccessfully_registration_no_username(self): response = self.client.post( reverse('api_register'), {'password': 'AekaiLe0ga'}, - Authorization=f'Token {token.key}', ) self.assertEqual(response.status_code, HTTP_400_BAD_REQUEST) @@ -142,7 +124,6 @@ def test_post_unsuccessfully_registration_invalid_email(self): response = self.client.post( reverse('api_register'), {'username': 'restapi', 'email': 'example.com', 'password': 'AekaiLe0ga'}, - Authorization=f'Token {token.key}', ) self.assertEqual(response.status_code, HTTP_400_BAD_REQUEST) @@ -157,7 +138,6 @@ def test_post_unsuccessfully_registration_invalid_email_2(self): response = self.client.post( reverse('api_register'), {'username': 'restapi', 'email': 'admin@example.com', 'password': 'AekaiLe0ga'}, - Authorization=f'Token {token.key}', ) self.assertEqual(response.status_code, HTTP_400_BAD_REQUEST)