From bb40d134e14c94bb2193ccf646079189081b703c Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Tue, 25 Jun 2024 20:39:40 +0200 Subject: [PATCH] disable tests that rely on old endpoints - to be replaced --- .../InvenTree/settings/settings_js.html | 2 ++ src/backend/InvenTree/users/test_api.py | 32 +++++++++---------- src/backend/InvenTree/users/tests.py | 4 ++- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/backend/InvenTree/templates/InvenTree/settings/settings_js.html b/src/backend/InvenTree/templates/InvenTree/settings/settings_js.html index 8e857739a7..b19beb0a8a 100644 --- a/src/backend/InvenTree/templates/InvenTree/settings/settings_js.html +++ b/src/backend/InvenTree/templates/InvenTree/settings/settings_js.html @@ -82,6 +82,7 @@ $("#edit-user").on('click', function() { ); }); +/* $("#edit-password").on('click', function() { launchModalForm( "{% url 'set-password' %}", @@ -90,3 +91,4 @@ $("#edit-password").on('click', function() { } ); }); +*/ diff --git a/src/backend/InvenTree/users/test_api.py b/src/backend/InvenTree/users/test_api.py index 6e9805c601..0ce6772b9c 100644 --- a/src/backend/InvenTree/users/test_api.py +++ b/src/backend/InvenTree/users/test_api.py @@ -48,14 +48,14 @@ class UserAPITests(InvenTreeAPITestCase): self.assertIn('name', response.data) - def test_logout(self): - """Test api logout endpoint.""" - token_key = self.get(url=reverse('api-token')).data['token'] - self.client.logout() - self.client.credentials(HTTP_AUTHORIZATION='Token ' + token_key) + # def test_logout(self): + # """Test api logout endpoint.""" + # token_key = self.get(url=reverse('api-token')).data['token'] + # self.client.logout() + # self.client.credentials(HTTP_AUTHORIZATION='Token ' + token_key) - self.post(reverse('api-logout'), expected_code=200) - self.get(reverse('api-token'), expected_code=401) + # self.post(reverse('api-logout'), expected_code=200) + # self.get(reverse('api-token'), expected_code=401) def test_login_redirect(self): """Test login redirect endpoint.""" @@ -176,12 +176,12 @@ class UserTokenTests(InvenTreeAPITestCase): self.client.get(me, expected_code=200) - def test_buildin_token(self): - """Test the built-in token authentication.""" - response = self.post( - reverse('rest_login'), - {'username': self.username, 'password': self.password}, - expected_code=200, - ) - self.assertIn('key', response.data) - self.assertTrue(response.data['key'].startswith('inv-')) + # def test_buildin_token(self): + # """Test the built-in token authentication.""" + # response = self.post( + # reverse('rest_login'), + # {'username': self.username, 'password': self.password}, + # expected_code=200, + # ) + # self.assertIn('key', response.data) + # self.assertTrue(response.data['key'].startswith('inv-')) diff --git a/src/backend/InvenTree/users/tests.py b/src/backend/InvenTree/users/tests.py index 968d9024b3..a95e5b6260 100644 --- a/src/backend/InvenTree/users/tests.py +++ b/src/backend/InvenTree/users/tests.py @@ -274,8 +274,9 @@ class OwnerModelTest(InvenTreeTestCase): class MFALoginTest(InvenTreeAPITestCase): """Some simplistic tests to ensure that MFA is working.""" + """ def test_api(self): - """Test that the API is working.""" + ""Test that the API is working."" auth_data = {'username': self.username, 'password': self.password} login_url = reverse('api-login') @@ -313,3 +314,4 @@ class MFALoginTest(InvenTreeAPITestCase): # Wrong login should not work auth_data['password'] = 'wrong' self.post(login_url, auth_data, expected_code=401) + """