From 2a461c41615f68796b598e73642a9a5ffa3f7836 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Sun, 28 Apr 2024 23:20:42 +0200
Subject: [PATCH] Minor refactoring.

---
 tests/utils.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/utils.py b/tests/utils.py
index 2a919a3..34f429e 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -70,9 +70,9 @@ class TestCaseWithServer(TestCaseWithDB):
                    'Content-Length': str(len(encoded_form_data))}
         self.conn.request('POST', target,
                           body=encoded_form_data, headers=headers)
-        if redirect_location == '':
-            redirect_location = target
         if 302 == expected_code:
+            if redirect_location == '':
+                redirect_location = target
             self.check_redirect(redirect_location)
         else:
             self.assertEqual(self.conn.getresponse().status, expected_code)
-- 
2.30.2