1from seahub.test_utils import BaseTestCase
2
3from seahub.role_permissions.settings import merge_roles
4
5K1 = 'k1'
6K2 = 'k2'
7
8class SettingsTest(BaseTestCase):
9    def test_merge_rols(self, ):
10        default = {
11            'default': {
12                K1: True,
13                K2: True,
14            },
15        }
16
17        custom = {
18            'default': {
19                K1: False,
20                K2: False,
21            },
22            'custom': {
23                K1: True,
24            }
25        }
26
27        merged = merge_roles(default, custom)
28        assert merged['default'][K1] is False
29        assert merged['default'][K2] is False
30        assert merged['custom'][K1] is True
31        assert merged['custom'][K2] is True
32