Skip to content

Commit 6d9a8c1

Browse files
committed
[IMP] auth_admin_passkey. Add tests for setting/getting config.
1 parent ad4d562 commit 6d9a8c1

File tree

2 files changed

+54
-2
lines changed

2 files changed

+54
-2
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright (C) 2013-2014 GRAP (http://www.grap.coop)
32
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
4-
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
3+
# License AGPL-3 - See https://www.gnu.org/licenses/agpl-3.0.html
54

65
from . import test_auth_admin_passkey
76
from . import test_ui
7+
from . import test_config
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2019 Therp BV (https://therp.nl)
3+
# License AGPL-3 - See https://www.gnu.org/licenses/agpl-3.0.html
4+
from odoo.tests import common
5+
6+
7+
@common.post_install(True)
8+
class TestConfig(common.TransactionCase):
9+
def test_set_get_config(self):
10+
"""Test configuration methods."""
11+
config_model = self.env["base.config.settings"]
12+
config = config_model.create(
13+
{
14+
"auth_admin_passkey_send_to_admin": False,
15+
"auth_admin_passkey_send_to_user": False,
16+
}
17+
)
18+
# Set email admin and user to False (and back again).
19+
config.set_auth_admin_passkey_send_to_admin()
20+
config.set_auth_admin_passkey_send_to_user()
21+
self.assertEqual(
22+
False,
23+
config_model.get_default_auth_admin_passkey_send_to_admin([])[
24+
"auth_admin_passkey_send_to_admin"
25+
],
26+
)
27+
self.assertEqual(
28+
False,
29+
config_model.get_default_auth_admin_passkey_send_to_user([])[
30+
"auth_admin_passkey_send_to_user"
31+
],
32+
)
33+
config.write(
34+
{
35+
"auth_admin_passkey_send_to_admin": True,
36+
"auth_admin_passkey_send_to_user": True,
37+
}
38+
)
39+
config.set_auth_admin_passkey_send_to_admin()
40+
config.set_auth_admin_passkey_send_to_user()
41+
self.assertEqual(
42+
True,
43+
config_model.get_default_auth_admin_passkey_send_to_admin([])[
44+
"auth_admin_passkey_send_to_admin"
45+
],
46+
)
47+
self.assertEqual(
48+
True,
49+
config_model.get_default_auth_admin_passkey_send_to_user([])[
50+
"auth_admin_passkey_send_to_user"
51+
],
52+
)

0 commit comments

Comments
 (0)