-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MIG] auth_user_case_insensitive: mig #2
Conversation
def test_login_login_is_lowercased(self): | ||
"""It should verify the login is set to lowercase on login""" | ||
# TODO Write a proper test, that does not use | ||
# the admin user, but instead uses the one | ||
# in `_new_record` method. | ||
res_id = self.model_obj._login( | ||
self.env.registry.db_name, | ||
"aDMIn", | ||
"admin", | ||
{"interactive": True}, | ||
) | ||
rec_id = self.model_obj.search([("login", "=", "admin")]) | ||
self.assertEqual( | ||
rec_id.id, | ||
res_id, | ||
"Login with with uppercase chars was not \ | ||
successful", | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could not make this test work with the fresh user, so I used the default admin credentials.
Link to original tests: https://github.com/OCA/server-auth/blob/fd4947f04ffd8d7d5b4cf63c06a8dea71df40722/auth_user_case_insensitive/tests/test_res_users.py#L48
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't there a way to see what exact changes was made? I mean, initial commit and actual changes could be included in separate commits, because now it's not clear what the changes are.
…f `_login` * Update code and tests to override `_login` method
Updated by Update PO files to match POT (msgmerge) hook in Weblate.
Currently translated at 100.0% (2 of 2 strings) Translation: server-auth-12.0/server-auth-12.0-auth_user_case_insensitive Translate-URL: https://translation.odoo-community.org/projects/server-auth-12-0/server-auth-12-0-auth_user_case_insensitive/pt_BR/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: server-auth-13.0/server-auth-13.0-auth_user_case_insensitive Translate-URL: https://translation.odoo-community.org/projects/server-auth-13-0/server-auth-13-0-auth_user_case_insensitive/
4b17643
to
d44a4ea
Compare
d44a4ea
to
e1f7327
Compare
auth_user_case_insensitive/hooks.py
Outdated
users.append(login) | ||
else: | ||
raise ValidationError( | ||
_("Conflicting user logins exist for `%s`") % login |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_("Conflicting user logins exist for `%s`") % login | |
_("Conflicting user logins exist for `%s`", login) |
#. module: auth_user_case_insensitive | ||
#: model:ir.model,name:auth_user_case_insensitive.model_res_users | ||
msgid "Users" | ||
msgstr "用户" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could include lt.po
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added lt.po, not sure how great my translation is though, as there is no good translation for the phrase case sensitive
.
e1f7327
to
6a01560
Compare
#: code:addons/auth_user_case_insensitive/hooks.py:0 | ||
#, python-format | ||
msgid "Conflicting user logins exist for `%s`" | ||
msgstr "Vartotojams `%s` egzistuoja konfliktuojantys prisijungimai" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That query checks for uniqueness, no?
msgstr "Vartotojams `%s` egzistuoja konfliktuojantys prisijungimai" | |
msgstr "Vartotojo prisijungimo vardas `%s` jau egzistuoja" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort of, it checks if there are 2 usernames that are identical when lowercased, check happens pre-install
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it to Egzistuoja keli vartotojai su prisijungimu
%s``
#. module: auth_user_case_insensitive | ||
#: model:ir.model.fields,help:auth_user_case_insensitive.field_res_users__login | ||
msgid "Used to log into the system. Case insensitive." | ||
msgstr "Naudojamas prisijungti į sistemą. Nereikšminga ar vesite didžiosiomis ar mažosiomis raidėmis." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
msgstr "Naudojamas prisijungti į sistemą. Nereikšminga ar vesite didžiosiomis ar mažosiomis raidėmis." | |
msgstr "Naudojamas prisijungti į sistemą. Raidžių dydis nesvarbus." |
6a01560
to
c468a99
Compare
partner_id = self.env["res.partner"].create(self.partner_vals) | ||
self.vals["partner_id"] = partner_id.id | ||
return self.model_obj.create(self.vals) | ||
|
||
def test_login_is_lowercased_on_create(self): | ||
""" It should verify the login is set to lowercase on create """ | ||
"""It should verify the login is set to lowercase on create""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if changing docstring, add period at the end, to make it pydocstyle257 compatible. Also docstring should start with a verb for method. Instead of It should verify
, use Verify the login is set..
@@ -20,13 +18,13 @@ def setUp(self): | |||
self.model_obj = self.env["res.users"] | |||
|
|||
def _new_record(self): | |||
""" It should enerate a new record to test with """ | |||
"""It should enerate a new record to test with""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is generate
I guess, not enerate
c468a99
to
22c41d7
Compare
22c41d7
to
da63b64
Compare
[BRANCH] mig/1048-user-case-insensitive-hml
oca/server-auth PR: OCA#361