blob: 17b20a82bb53738f2f1ad3db34a024842c839fa0 [file] [log] [blame]
Vijay VK339ca1c2018-03-27 02:05:36 +01001import pytest
2import unittest
3import trapd_exit
4
5pid_file="/tmp/test_pid_file"
6pid_file_dne="/tmp/test_pid_file_NOT"
7
8import trapd_settings as tds
Vijay VK339ca1c2018-03-27 02:05:36 +01009
10class test_cleanup_and_exit(unittest.TestCase):
11 """
12 Test for presense of required vars
13 """
14
15
16 def test_nonexistent_dict(self):
17 """
18 Test nosuch var
19 """
20 tds.init()
21 try:
22 tds.no_such_var
23 result = True
24 except:
25 result = False
26
27 self.assertEqual(result, False)
28
29 def test_config_dict(self):
30 """
31 Test config dict
32 """
33 tds.init()
34 try:
35 tds.c_config
36 result = True
37 except:
38 result = False
39
40 self.assertEqual(result, True)
41
42 def test_dns_cache_ip_to_name(self):
43 """
44 Test dns cache name dict
45 """
46
47 tds.init()
48 try:
49 tds.dns_cache_ip_to_name
50 result = True
51 except:
52 result = False
53
54 self.assertEqual(result, True)
55
56 def test_dns_cache_ip_expires(self):
57 """
58 Test dns cache ip expires dict
59 """
60
61 tds.init()
62 try:
63 tds.dns_cache_ip_expires
64 result = True
65 except:
66 result = False
67
68 self.assertEqual(result, True)
69
70if __name__ == '__main__':
71 # tds.init()
72 unittest.main()