diff --git a/CHANGELOG b/CHANGELOG index 57aea1b..9b18fea 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,11 +1,12 @@ -30-08-2022 (AKo): v0.5.3.1 +30-08-2022 (AKo): v0.5.3.2 - Pyros container has fix hostname (hostname of local machine) - Adding switch of database if we're not in docker and not on the computer that host the database - Add fix IP adress for db_pyros and pyros container, updating database.env files to connect to db_pyros - Add new shell script for build (with verification that user isn't root) - Fixing endofline issue of windows - Update logout for Django 4.1 (Send form POST) - + - Fixing test with new logout call + 29-08-2022 (AKo): v0.5.2.1 - Adding colors for recieved and sended commands of an agent. - Renabling print when pulling git repo of guitastro diff --git a/VERSION b/VERSION index f92cb92..38ba203 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.3.1 +0.5.3.2 diff --git a/pyros.py b/pyros.py index 2add563..e4e0e6c 100755 --- a/pyros.py +++ b/pyros.py @@ -705,6 +705,9 @@ def test(app): print("Running tests") os.environ["PATH_TO_OBSCONF_FOLDER"] = os.path.join( os.path.abspath(PYROS_DJANGO_BASE_DIR), "obsconfig/fixtures/") + + os.environ["PATH_TO_OBSCONF_FILE"] = os.path.join(os.path.abspath( + PYROS_DJANGO_BASE_DIR), "obsconfig/fixtures/observatory_configuration_ok_simple.yml") os.environ["unit_name"] = "" configfile = 'config_pyros.yml' os.environ["pyros_config_file"] = os.path.join(os.path.abspath( diff --git a/src/core/pyros_django/routine_manager/tests.py b/src/core/pyros_django/routine_manager/tests.py index ae43d79..39a89bd 100644 --- a/src/core/pyros_django/routine_manager/tests.py +++ b/src/core/pyros_django/routine_manager/tests.py @@ -124,7 +124,7 @@ class SequencesTests(TestCase): seq.save() def logout(self): - self.client.get(reverse("user_logout")) + self.client.post(reverse("user_logout")) print("Log out") def login_as_user(self, number): diff --git a/src/core/pyros_django/scientific_program/tests.py b/src/core/pyros_django/scientific_program/tests.py index edcd4aa..64cb4b0 100644 --- a/src/core/pyros_django/scientific_program/tests.py +++ b/src/core/pyros_django/scientific_program/tests.py @@ -50,7 +50,7 @@ class ScientificProgramTests(TestCase): self.usr8.save() def logout(self): - self.client.get(reverse("user_logout")) + self.client.post(reverse("user_logout")) print("Log out") def login_as_user(self,number): if number == 1: diff --git a/src/core/pyros_django/user_manager/tests.py b/src/core/pyros_django/user_manager/tests.py index 7e68c74..e06ff96 100644 --- a/src/core/pyros_django/user_manager/tests.py +++ b/src/core/pyros_django/user_manager/tests.py @@ -204,7 +204,7 @@ class UserManagerTests(TestCase): self.assertTrue(new_user.is_active) # log out as unit_pi path = reverse("user_logout") - self.client.get(path) + self.client.post(path) # log in as new user (toto) response = self.client.post(reverse("login_validation"),{"email":"toto@titi.fr","password":"aze"}) self.assertEqual(int(self.client.session['_auth_user_id']), new_user.pk) @@ -243,7 +243,7 @@ class UserManagerTests(TestCase): response = self.client.get(reverse("user_detail",args=[user.id])) self.assertEqual(response.status_code,200) # disconnect - response = self.client.get(reverse("user_logout")) + response = self.client.post(reverse("user_logout")) # redirected to home page self.assertEqual(response.status_code,302) self.assertNotIn('_auth_user_id',self.client.session.keys()) @@ -287,7 +287,7 @@ class UserManagerTests(TestCase): self.assertNotContains(response,"u5") # disconnect u1 - self.client.get(reverse("user_logout")) + self.client.post(reverse("user_logout")) # connect as u2 @@ -409,7 +409,7 @@ class UserManagerTests(TestCase): # When a user attempt to modify another user's attribute, he will be redirected self.assertEqual(response.status_code,302) # log out as u1 - self.client.get(reverse("user_logout")) + self.client.post(reverse("user_logout")) # log in as u2 response = self.client.post(reverse("login_validation"),{"email":user2.email,"password":"password123"}) self.assertEqual(response.status_code,302) @@ -454,7 +454,7 @@ class UserManagerTests(TestCase): self.assertEqual(response.status_code,302) self.assertFalse(user.is_active) # log out as u2 - self.client.get(reverse("user_logout")) + self.client.post(reverse("user_logout")) # u1 attempt to connect on PyROS response = self.client.post(reverse("login_validation"),{"email":user.email,"password":"password123"}) self.assertEqual(response.status_code,200) @@ -470,7 +470,7 @@ class UserManagerTests(TestCase): self.assertEqual(response.status_code,302) self.assertTrue(user.is_active) # log out as u2 - self.client.get(reverse("user_logout")) + self.client.post(reverse("user_logout")) # connect as u1 response = self.client.post(reverse("login_validation"),{"email":user.email,"password":"password123"}) self.assertEqual(response.status_code,302) @@ -522,7 +522,7 @@ class UserManagerTests(TestCase): self.assertEqual("Unit-PI",user2.get_roles_str()) # log out as u1 - self.client.get(reverse("user_logout")) + self.client.post(reverse("user_logout")) # log in a u2 response = self.client.post(reverse("login_validation"),{"email":user2.email,"password":"password123"}) self.assertEqual(response.status_code,302) @@ -640,7 +640,7 @@ class UserManagerTests(TestCase): self.assertNotEqual(is_user_delete,True) # log out as u1 - self.client.get(reverse("user_logout")) + self.client.post(reverse("user_logout")) # log in as u2 response = self.client.post(reverse("login_validation"),{"email":user2.email,"password":"password123"}) diff --git a/src/core/pyros_django/user_manager/views.py b/src/core/pyros_django/user_manager/views.py index 79313d9..d947515 100644 --- a/src/core/pyros_django/user_manager/views.py +++ b/src/core/pyros_django/user_manager/views.py @@ -178,7 +178,7 @@ def user_logout(request): ''' View called to log out. Redirects on login page. ''' - if request.POST: + if request.method == "POST": log.info(f"User {request.user} did action logout") logout(request) config = OBSConfig( -- libgit2 0.21.2