1#!/usr/bin/env python3
2# This file is part of Xpra.
3# Copyright (C) 2011-2017 Antoine Martin <antoine@xpra.org>
4# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
5# later version. See the file COPYING for details.
6
7import unittest
8
9from xpra.os_util import POSIX
10from xpra.version_util import version_compat_check, get_host_info, get_version_info, get_platform_info
11
12
13class TestVersionUtilModule(unittest.TestCase):
14
15    def test_version_compat_check_invalid(self):
16        from xpra import __version__
17        self.assertIsNone(version_compat_check(__version__))
18        self.assertIsNotNone(version_compat_check("0.1"))
19
20    def test_get_host_info(self):
21        attrs = ["pid"]
22        if POSIX:
23            attrs += ["uid", "pid"]
24        for x in attrs:
25            self.assertTrue(x in get_host_info(), "%s not found in host info" % x)
26
27    def test_get_version_info(self):
28        for x in ("version", "revision"):
29            self.assertTrue(x in get_version_info(), "%s not found in version info" % x)
30
31    def test_get_platform_info(self):
32        for x in ("release", "name"):
33            self.assertTrue(x in get_platform_info(), "%s not found in platform info" % x)
34
35
36def main():
37    unittest.main()
38
39if __name__ == '__main__':
40    main()
41