summaryrefslogtreecommitdiffstats
path: root/tests/unit/test-030-recipientpolicy.py
blob: 0f50747df2d3a3685ba988328e2bfc8ddb3420ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# -*- coding: utf-8 -*-

import unittest

from pykolab.plugins.recipientpolicy import KolabRecipientpolicy

policy = KolabRecipientpolicy()


class TestRecipientPolicy(unittest.TestCase):
    def test_001_primary_mail(self):
        """
            The spaces in attributes used for mail generation.
        """

        entry = {
            'surname': ' sn ',
            'givenname': ' gn ',
        }

        mail = policy.set_primary_mail(
            primary_mail='%(givenname)s.%(surname)s@%(domain)s',
            primary_domain='example.org',
            entry=entry
        )

        self.assertEqual('gn.sn@example.org', mail)

if __name__ == '__main__':
    unittest.main()