This is an automated email from the ASF dual-hosted git repository.

dill0wn pushed a commit to branch dw/8455-part2
in repository https://gitbox.apache.org/repos/asf/allura.git

commit b92975160a9569c97ec52df57038093116128254
Author: Dillon Walls <[email protected]>
AuthorDate: Fri Sep 23 18:43:16 2022 +0000

    [#8455] converted yield test to pytest.mark.parametrize
---
 Allura/allura/tests/functional/test_auth.py | 52 +++++++++++++++--------------
 1 file changed, 27 insertions(+), 25 deletions(-)

diff --git a/Allura/allura/tests/functional/test_auth.py 
b/Allura/allura/tests/functional/test_auth.py
index 06a3daf9d..c016a39b1 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -32,6 +32,7 @@ from ming.orm.ormsession import ThreadLocalORMSession, session
 from tg import config, expose
 from mock import patch, Mock
 import mock
+import pytest
 from tg import tmpl_context as c, app_globals as g
 
 from allura.tests import TestController
@@ -562,36 +563,37 @@ class TestAuth(TestController):
         assert hash_expiry == '04-08-2020'
         return user
 
-    def test_token_generator(self):
+    @pytest.mark.parametrize(['change_params'], [
+        pytest.param({'new_addr.addr': '[email protected]',  # Change 
primary address
+                      'primary_addr': '[email protected]'},
+                     id='change_primary'),
+        pytest.param({'new_addr.addr': '[email protected]',  # Claim new address
+                      'new_addr.claim': 'Claim Address',
+                      'primary_addr': '[email protected]',
+                      'password': 'foo',
+                      'preferences.email_format': 'plain'},
+                     id='claim_new'),
+        pytest.param({'addr-1.ord': '1',  # remove [email protected]
+                      'addr-1.delete': 'on',
+                      'addr-2.ord': '2',
+                      'new_addr.addr': '',
+                      'primary_addr': '[email protected]',
+                      'password': 'foo',
+                      'preferences.email_format': 'plain'},
+                     id='remove_one'),
+        pytest.param({'addr-1.ord': '1',  # Remove email
+                      'addr-2.ord': '2',
+                      'addr-2.delete': 'on',
+                      'new_addr.addr': '',
+                      'primary_addr': '[email protected]'},
+                     id='remove_all'),
+    ])
+    def test_email_change_invalidates_token(self, change_params):
         """ Generates new token invalidation tests.
 
         The tests cover: changing, claiming, updating, removing email 
addresses.
         :returns: email_change_invalidates_token
         """
-        _params = [{'new_addr.addr': '[email protected]',  # Change primary 
address
-                    'primary_addr': '[email protected]', },
-                   {'new_addr.addr': '[email protected]',  # Claim new address
-                    'new_addr.claim': 'Claim Address',
-                    'primary_addr': '[email protected]',
-                    'password': 'foo',
-                    'preferences.email_format': 'plain'},
-                   {'addr-1.ord': '1',  # remove [email protected]
-                    'addr-1.delete': 'on',
-                    'addr-2.ord': '2',
-                    'new_addr.addr': '',
-                    'primary_addr': '[email protected]',
-                    'password': 'foo',
-                    'preferences.email_format': 'plain'},
-                   {'addr-1.ord': '1',  # Remove email
-                    'addr-2.ord': '2',
-                    'addr-2.delete': 'on',
-                    'new_addr.addr': '',
-                    'primary_addr': '[email protected]'}]
-
-        for param in _params:
-            yield self.email_change_invalidates_token, param
-
-    def email_change_invalidates_token(self, change_params):
         user = self._create_password_reset_hash()
         session(user).flush(user)
 

Reply via email to