blob: 5625d7830184890d12056b8242d4602d72f35df7 [file] [log] [blame]
Ladue, David (dl3158)9c9a86f2020-02-14 12:02:30 -05001# ============LICENSE_START=======================================================
Hansen, Tony (th1395)4b6b3462022-08-17 21:36:24 +00002# Copyright (c) 2019-2022 AT&T Intellectual Property. All rights reserved.
Ladue, David (dl3158)9c9a86f2020-02-14 12:02:30 -05003# ================================================================================
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15# ============LICENSE_END=========================================================
16
Vijay VK339ca1c2018-03-27 02:05:36 +010017import unittest
18import trapd_exit
19
Hansen, Tony (th1395)cf7f98a2021-12-02 20:42:43 +000020pid_file = "/tmp/test_pid_file"
21pid_file_dne = "/tmp/test_pid_file_NOT"
Vijay VK339ca1c2018-03-27 02:05:36 +010022
23import trapd_settings as tds
Vijay VK339ca1c2018-03-27 02:05:36 +010024
Hansen, Tony (th1395)cf7f98a2021-12-02 20:42:43 +000025
Hansen, Tony (th1395)4b6b3462022-08-17 21:36:24 +000026class test_trapd_settings(unittest.TestCase):
Vijay VK339ca1c2018-03-27 02:05:36 +010027 """
28 Test for presense of required vars
29 """
Vijay VK339ca1c2018-03-27 02:05:36 +010030
Hansen, Tony (th1395)4b6b3462022-08-17 21:36:24 +000031 @classmethod
32 def setUpClass(cls):
33 tds.init()
34
35
Vijay VK339ca1c2018-03-27 02:05:36 +010036 def test_nonexistent_dict(self):
37 """
38 Test nosuch var
39 """
Hansen, Tony (th1395)4b6b3462022-08-17 21:36:24 +000040 self.assertFalse(hasattr(tds, 'no_such_var'))
Vijay VK339ca1c2018-03-27 02:05:36 +010041
Hansen, Tony (th1395)cf7f98a2021-12-02 20:42:43 +000042
Vijay VK339ca1c2018-03-27 02:05:36 +010043 def test_config_dict(self):
44 """
45 Test config dict
46 """
Hansen, Tony (th1395)4b6b3462022-08-17 21:36:24 +000047 self.assertTrue(hasattr(tds, 'c_config'))
Vijay VK339ca1c2018-03-27 02:05:36 +010048
Hansen, Tony (th1395)cf7f98a2021-12-02 20:42:43 +000049
Vijay VK339ca1c2018-03-27 02:05:36 +010050 def test_dns_cache_ip_to_name(self):
51 """
Hansen, Tony (th1395)cf7f98a2021-12-02 20:42:43 +000052 Test dns cache name dict
Vijay VK339ca1c2018-03-27 02:05:36 +010053 """
Hansen, Tony (th1395)4b6b3462022-08-17 21:36:24 +000054 self.assertTrue(hasattr(tds, 'dns_cache_ip_to_name'))
Vijay VK339ca1c2018-03-27 02:05:36 +010055
Vijay VK339ca1c2018-03-27 02:05:36 +010056
57 def test_dns_cache_ip_expires(self):
58 """
Hansen, Tony (th1395)cf7f98a2021-12-02 20:42:43 +000059 Test dns cache ip expires dict
Vijay VK339ca1c2018-03-27 02:05:36 +010060 """
Hansen, Tony (th1395)4b6b3462022-08-17 21:36:24 +000061 self.assertTrue(hasattr(tds, 'dns_cache_ip_expires'))
Vijay VK339ca1c2018-03-27 02:05:36 +010062
Hansen, Tony (th1395)cf7f98a2021-12-02 20:42:43 +000063
Hansen, Tony (th1395)4b6b3462022-08-17 21:36:24 +000064if __name__ == "__main__": # pragma: no cover
Vijay VK339ca1c2018-03-27 02:05:36 +010065 unittest.main()