##// END OF EJS Templates
feat(2fa): refactor logic arround validation/recoverycodes and workflows of configuration of 2fa...
feat(2fa): refactor logic arround validation/recoverycodes and workflows of configuration of 2fa - recovery codes are shown in 1 place only - save status about view of recovery codes - made the logic of saving states into user_data more explicit and no longer relly on hacky DB transaction logic - turn JS forms into a regular forms

File last commit:

r5173:95a4b30f default
r5367:a11e6ff3 default
Show More
test_my_account_emails.py
66 lines | 2.7 KiB | text/x-python | PythonLexer
/ rhodecode / apps / my_account / tests / test_my_account_emails.py
copyrights: updated for 2023
r5088 # Copyright (C) 2010-2023 RhodeCode GmbH
my-account: moved emails config into pyramid views.
r1816 #
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3
# (only), as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This program is dual-licensed. If you wish to learn more about the
# RhodeCode Enterprise Edition, including its added features, Support services,
# and proprietary license terms, please see https://rhodecode.com/licenses/
import pytest
from rhodecode.apps._base import ADMIN_PREFIX
from rhodecode.model.db import User, UserEmailMap
from rhodecode.tests import (
TestController, TEST_USER_ADMIN_LOGIN, TEST_USER_REGULAR_EMAIL,
Bartłomiej Wołyńczyk
my-account: security change, added select filed with email from extra emails while editing user profile, now adding extra emails required type password. Task #5386
r2592 assert_session_flash, TEST_USER_REGULAR_PASS)
my-account: moved emails config into pyramid views.
r1816 from rhodecode.tests.fixture import Fixture
tests: refactor code to use a single test url generator
r5173 from rhodecode.tests.routes import route_path
my-account: moved emails config into pyramid views.
r1816
tests: refactor code to use a single test url generator
r5173 fixture = Fixture()
my-account: moved emails config into pyramid views.
r1816
class TestMyAccountEmails(TestController):
def test_my_account_my_emails(self):
self.log_user()
response = self.app.get(route_path('my_account_emails'))
response.mustcontain('No additional emails specified')
def test_my_account_my_emails_add_remove(self):
self.log_user()
response = self.app.get(route_path('my_account_emails'))
response.mustcontain('No additional emails specified')
response = self.app.post(route_path('my_account_emails_add'),
Bartłomiej Wołyńczyk
my-account: security change, added select filed with email from extra emails while editing user profile, now adding extra emails required type password. Task #5386
r2592 {'email': 'foo@barz.com',
'current_password': TEST_USER_REGULAR_PASS,
my-account: moved emails config into pyramid views.
r1816 'csrf_token': self.csrf_token})
response = self.app.get(route_path('my_account_emails'))
email_id = UserEmailMap.query().filter(
UserEmailMap.user == User.get_by_username(
TEST_USER_ADMIN_LOGIN)).filter(
UserEmailMap.email == 'foo@barz.com').one().email_id
response.mustcontain('foo@barz.com')
response.mustcontain('<input id="del_email_id" name="del_email_id" '
'type="hidden" value="%s" />' % email_id)
response = self.app.post(
route_path('my_account_emails_delete'), {
'del_email_id': email_id,
'csrf_token': self.csrf_token})
assert_session_flash(response, 'Email successfully deleted')
response = self.app.get(route_path('my_account_emails'))
response.mustcontain('No additional emails specified')