Skip to content

Commit

Permalink
backward compatibility and test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mishaschwartz committed Nov 28, 2023
1 parent e4694fe commit 427e724
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def upgrade():
except sa.exc.IntegrityError as e:
raise Exception("{}\nPlease manually update conflicting user_names and try again".format(e)) from e
session = Session(bind=op.get_bind())
for user in session.execute(sa.select(users)):
for user in session.execute(sa.select([users])):
lower_user_name = user.user_name.lower()
if user.user_name != lower_user_name:
print(
Expand Down
21 changes: 0 additions & 21 deletions tests/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -7601,27 +7601,6 @@ def test_AddUser_FormSubmit_WithExtraUsernameRegex_Invalid(self):
msg = s.Users_CheckInfo_UserNameValueExtraRegex_BadRequestResponseSchema.description
utils.check_val_is_in(msg, html.unescape(body))

@runner.MAGPIE_TEST_USERS
def test_AddUser_FormSubmit_WithExtraUsernameRegex_CaseInvalid(self):
"""
Check that the extra_user_name_regex setting is used to validate a new user name when the user name is
invalid according to that regex because the case is incorrect but is valid according to the ax.PARAM_REGEX.
.. versionchanged:: 3.37.1
"""
utils.warn_version(self, "case sensitive user name extra regex", "3.37.1", skip=True)
with utils.mocked_get_settings(settings={"magpie.user_name_extra_regex": "^[a-z]+$"}):
data = {"user_name": "UpperCaseUserName", "group_name": get_constant("MAGPIE_USERS_GROUP"),
"email": "{}@mail.com".format(self.test_user_name),
"password": self.test_user_name, "confirm": self.test_user_name}
path = "/ui/users/add"
form = "add_user_form"
resp = utils.TestSetup.check_FormSubmit(self, form_match=form, form_submit="create", form_data=data,
path=path)
body = utils.check_ui_response_basic_info(resp)
msg = s.Users_CheckInfo_UserNameValueExtraRegex_BadRequestResponseSchema.description
utils.check_val_is_in(msg, html.unescape(body))

@runner.MAGPIE_TEST_USERS
def test_AddUser_FormSubmit_WithExtraUsernameRegex_ValidGoodUsername(self):
"""
Expand Down

0 comments on commit 427e724

Please sign in to comment.