From 1271eeca327bb017e95b9a73a4b585923a47d806 Mon Sep 17 00:00:00 2001 From: Dave Lasley Date: Wed, 18 Jan 2017 11:31:25 -0800 Subject: [PATCH] [MIG] auth_totp: Upgrade to v10 * Rename manifest * Change openerp references to odoo * Bump version * Add pyotp back to requirements --- auth_totp/README.rst | 2 +- auth_totp/{__openerp__.py => __manifest__.py} | 2 +- auth_totp/controllers/main.py | 8 ++++---- auth_totp/exceptions.py | 2 +- auth_totp/models/res_users.py | 4 ++-- auth_totp/models/res_users_authenticator.py | 2 +- auth_totp/models/res_users_device.py | 2 +- auth_totp/tests/test_main.py | 10 +++++----- auth_totp/tests/test_res_users.py | 6 +++--- auth_totp/tests/test_res_users_authenticator.py | 4 ++-- auth_totp/tests/test_res_users_authenticator_create.py | 6 +++--- auth_totp/wizards/res_users_authenticator_create.py | 4 ++-- requirements.txt | 1 + 13 files changed, 27 insertions(+), 26 deletions(-) rename auth_totp/{__openerp__.py => __manifest__.py} (96%) diff --git a/auth_totp/README.rst b/auth_totp/README.rst index 85a18c141..014cebe77 100644 --- a/auth_totp/README.rst +++ b/auth_totp/README.rst @@ -38,7 +38,7 @@ Install and enjoy. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/149/9.0 + :target: https://runbot.odoo-community.org/runbot/149/10.0 Known Issues / Roadmap ====================== diff --git a/auth_totp/__openerp__.py b/auth_totp/__manifest__.py similarity index 96% rename from auth_totp/__openerp__.py rename to auth_totp/__manifest__.py index d0ba987a7..7516e3335 100644 --- a/auth_totp/__openerp__.py +++ b/auth_totp/__manifest__.py @@ -5,7 +5,7 @@ { 'name': 'MFA Support', 'summary': 'Allows users to enable MFA and add optional trusted devices', - 'version': '9.0.1.0.0', + 'version': '10.0.1.0.0', 'category': 'Extra Tools', 'website': 'https://laslabs.com/', 'author': 'LasLabs, Odoo Community Association (OCA)', diff --git a/auth_totp/controllers/main.py b/auth_totp/controllers/main.py index 52638d6dd..e68cb72dd 100644 --- a/auth_totp/controllers/main.py +++ b/auth_totp/controllers/main.py @@ -5,10 +5,10 @@ from datetime import datetime, timedelta import json from werkzeug.contrib.securecookie import SecureCookie -from openerp import _, http, registry, SUPERUSER_ID -from openerp.api import Environment -from openerp.http import Response, request -from openerp.addons.web.controllers.main import Home +from odoo import _, http, registry, SUPERUSER_ID +from odoo.api import Environment +from odoo.http import Response, request +from odoo.addons.web.controllers.main import Home from ..exceptions import MfaTokenInvalidError, MfaTokenExpiredError diff --git a/auth_totp/exceptions.py b/auth_totp/exceptions.py index 2ea711515..40cd36dd6 100644 --- a/auth_totp/exceptions.py +++ b/auth_totp/exceptions.py @@ -2,7 +2,7 @@ # Copyright 2016-2017 LasLabs Inc. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). -from openerp.exceptions import AccessDenied +from odoo.exceptions import AccessDenied class MfaTokenError(AccessDenied): diff --git a/auth_totp/models/res_users.py b/auth_totp/models/res_users.py index 91c9a05a7..0a36866ce 100644 --- a/auth_totp/models/res_users.py +++ b/auth_totp/models/res_users.py @@ -5,8 +5,8 @@ from datetime import datetime, timedelta import random import string -from openerp import _, api, fields, models -from openerp.exceptions import AccessDenied, ValidationError +from odoo import _, api, fields, models +from odoo.exceptions import AccessDenied, ValidationError from ..exceptions import MfaTokenInvalidError, MfaTokenExpiredError diff --git a/auth_totp/models/res_users_authenticator.py b/auth_totp/models/res_users_authenticator.py index b7a86a8fc..170dee477 100644 --- a/auth_totp/models/res_users_authenticator.py +++ b/auth_totp/models/res_users_authenticator.py @@ -3,7 +3,7 @@ # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). import logging -from openerp import _, api, fields, models +from odoo import _, api, fields, models _logger = logging.getLogger(__name__) try: diff --git a/auth_totp/models/res_users_device.py b/auth_totp/models/res_users_device.py index 2b33bb538..f2f4d0f17 100644 --- a/auth_totp/models/res_users_device.py +++ b/auth_totp/models/res_users_device.py @@ -2,7 +2,7 @@ # Copyright 2016-2017 LasLabs Inc. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). -from openerp import fields, models +from odoo import fields, models class ResUsersDevice(models.Model): diff --git a/auth_totp/tests/test_main.py b/auth_totp/tests/test_main.py index bc8e953b6..105e3feb5 100644 --- a/auth_totp/tests/test_main.py +++ b/auth_totp/tests/test_main.py @@ -4,11 +4,11 @@ from datetime import datetime import mock -from openerp.http import Response -from openerp.tests.common import TransactionCase +from odoo.http import Response +from odoo.tests.common import TransactionCase from ..controllers.main import AuthTotp -CONTROLLER_PATH = 'openerp.addons.auth_totp.controllers.main' +CONTROLLER_PATH = 'odoo.addons.auth_totp.controllers.main' REQUEST_PATH = CONTROLLER_PATH + '.request' SUPER_PATH = CONTROLLER_PATH + '.Home.web_login' JSON_PATH = CONTROLLER_PATH + '.JsonSecureCookie' @@ -16,7 +16,7 @@ ENVIRONMENT_PATH = CONTROLLER_PATH + '.Environment' RESPONSE_PATH = CONTROLLER_PATH + '.Response' DATETIME_PATH = CONTROLLER_PATH + '.datetime' TRANSLATE_PATH_CONT = CONTROLLER_PATH + '._' -MODEL_PATH = 'openerp.addons.auth_totp.models.res_users' +MODEL_PATH = 'odoo.addons.auth_totp.models.res_users' GENERATE_PATH = MODEL_PATH + '.ResUsers.generate_mfa_login_token' VALIDATE_PATH = MODEL_PATH + '.ResUsers.validate_mfa_confirmation_code' TRANSLATE_PATH_MOD = MODEL_PATH + '._' @@ -41,7 +41,7 @@ class TestAuthTotp(TransactionCase): self.test_user.trusted_device_ids = None # Needed when tests are run with no prior requests (e.g. on a new DB) - patcher = mock.patch('openerp.http.request') + patcher = mock.patch('odoo.http.request') self.addCleanup(patcher.stop) patcher.start() diff --git a/auth_totp/tests/test_res_users.py b/auth_totp/tests/test_res_users.py index a0b030593..19118e740 100644 --- a/auth_totp/tests/test_res_users.py +++ b/auth_totp/tests/test_res_users.py @@ -5,8 +5,8 @@ from datetime import datetime import mock import string -from openerp.exceptions import ValidationError -from openerp.tests.common import TransactionCase +from odoo.exceptions import ValidationError +from odoo.tests.common import TransactionCase from ..exceptions import ( MfaTokenError, MfaTokenInvalidError, @@ -14,7 +14,7 @@ from ..exceptions import ( ) from ..models.res_users_authenticator import ResUsersAuthenticator -DATETIME_PATH = 'openerp.addons.auth_totp.models.res_users.datetime' +DATETIME_PATH = 'odoo.addons.auth_totp.models.res_users.datetime' class TestResUsers(TransactionCase): diff --git a/auth_totp/tests/test_res_users_authenticator.py b/auth_totp/tests/test_res_users_authenticator.py index 948043872..82d2f126d 100644 --- a/auth_totp/tests/test_res_users_authenticator.py +++ b/auth_totp/tests/test_res_users_authenticator.py @@ -3,9 +3,9 @@ # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). import mock -from openerp.tests.common import TransactionCase +from odoo.tests.common import TransactionCase -MOCK_PATH = 'openerp.addons.auth_totp.models.res_users_authenticator.pyotp' +MOCK_PATH = 'odoo.addons.auth_totp.models.res_users_authenticator.pyotp' class TestResUsersAuthenticator(TransactionCase): diff --git a/auth_totp/tests/test_res_users_authenticator_create.py b/auth_totp/tests/test_res_users_authenticator_create.py index a364fb5b2..1db130737 100644 --- a/auth_totp/tests/test_res_users_authenticator_create.py +++ b/auth_totp/tests/test_res_users_authenticator_create.py @@ -3,12 +3,12 @@ # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). import mock -from openerp.exceptions import ValidationError -from openerp.tests.common import TransactionCase +from odoo.exceptions import ValidationError +from odoo.tests.common import TransactionCase @mock.patch( - 'openerp.addons.auth_totp.wizards.res_users_authenticator_create.pyotp' + 'odoo.addons.auth_totp.wizards.res_users_authenticator_create.pyotp' ) class TestResUsersAuthenticatorCreate(TransactionCase): diff --git a/auth_totp/wizards/res_users_authenticator_create.py b/auth_totp/wizards/res_users_authenticator_create.py index 48b7fcab2..8131bf7bd 100644 --- a/auth_totp/wizards/res_users_authenticator_create.py +++ b/auth_totp/wizards/res_users_authenticator_create.py @@ -4,8 +4,8 @@ import logging import urllib -from openerp import _, api, fields, models -from openerp.exceptions import ValidationError +from odoo import _, api, fields, models +from odoo.exceptions import ValidationError _logger = logging.getLogger(__name__) try: diff --git a/requirements.txt b/requirements.txt index d6c435c7b..5fbc3c0bf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,7 @@ unidecode acme_tiny IPy validate_email +pyotp pysftp fdb sqlalchemy