aboutsummaryrefslogtreecommitdiff
path: root/tools/interface_generator/bin/templates_unittest.py
blob: a5adf0fc2a098cabe456e687d86b0762bcd51736 (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
31
32
33
34
35
36
#!/usr/bin/env python3

"""
templates unit tests
"""

import unittest
from pathlib import Path
import templates


class Templates(unittest.TestCase):
    """templates unit tests"""

    def test_get_templates_dir_is_valid(self):
        """verify that default templates dir is valid"""
        path = templates.get_templates_dir()

        self.assertTrue(isinstance(path, Path))
        self.assertTrue(path.exists())
        self.assertTrue(path.is_dir())

    def test_get_templates(self):
        """verify that templates are available by default"""
        path = templates.get_templates_dir()
        result = templates.get_templates(path)

        self.assertGreater(len(result), 0)
        for template in result:
            self.assertTrue(isinstance(template, Path))
            self.assertTrue(template.exists())
            self.assertTrue(template.is_file())


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