Ladue, David (dl3158) | 9c9a86f | 2020-02-14 12:02:30 -0500 | [diff] [blame] | 1 | # ============LICENSE_START======================================================= |
Hansen, Tony (th1395) | 4b6b346 | 2022-08-17 21:36:24 +0000 | [diff] [blame] | 2 | # Copyright (c) 2019-2022 AT&T Intellectual Property. All rights reserved. |
Ladue, David (dl3158) | 9c9a86f | 2020-02-14 12:02:30 -0500 | [diff] [blame] | 3 | # ================================================================================ |
| 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 VK | 339ca1c | 2018-03-27 02:05:36 +0100 | [diff] [blame] | 17 | import unittest |
| 18 | import trapd_exit |
| 19 | |
Hansen, Tony (th1395) | cf7f98a | 2021-12-02 20:42:43 +0000 | [diff] [blame] | 20 | pid_file = "/tmp/test_pid_file" |
| 21 | pid_file_dne = "/tmp/test_pid_file_NOT" |
Vijay VK | 339ca1c | 2018-03-27 02:05:36 +0100 | [diff] [blame] | 22 | |
| 23 | import trapd_settings as tds |
Vijay VK | 339ca1c | 2018-03-27 02:05:36 +0100 | [diff] [blame] | 24 | |
Hansen, Tony (th1395) | cf7f98a | 2021-12-02 20:42:43 +0000 | [diff] [blame] | 25 | |
Hansen, Tony (th1395) | 4b6b346 | 2022-08-17 21:36:24 +0000 | [diff] [blame] | 26 | class test_trapd_settings(unittest.TestCase): |
Vijay VK | 339ca1c | 2018-03-27 02:05:36 +0100 | [diff] [blame] | 27 | """ |
| 28 | Test for presense of required vars |
| 29 | """ |
Vijay VK | 339ca1c | 2018-03-27 02:05:36 +0100 | [diff] [blame] | 30 | |
Hansen, Tony (th1395) | 4b6b346 | 2022-08-17 21:36:24 +0000 | [diff] [blame] | 31 | @classmethod |
| 32 | def setUpClass(cls): |
| 33 | tds.init() |
| 34 | |
| 35 | |
Vijay VK | 339ca1c | 2018-03-27 02:05:36 +0100 | [diff] [blame] | 36 | def test_nonexistent_dict(self): |
| 37 | """ |
| 38 | Test nosuch var |
| 39 | """ |
Hansen, Tony (th1395) | 4b6b346 | 2022-08-17 21:36:24 +0000 | [diff] [blame] | 40 | self.assertFalse(hasattr(tds, 'no_such_var')) |
Vijay VK | 339ca1c | 2018-03-27 02:05:36 +0100 | [diff] [blame] | 41 | |
Hansen, Tony (th1395) | cf7f98a | 2021-12-02 20:42:43 +0000 | [diff] [blame] | 42 | |
Vijay VK | 339ca1c | 2018-03-27 02:05:36 +0100 | [diff] [blame] | 43 | def test_config_dict(self): |
| 44 | """ |
| 45 | Test config dict |
| 46 | """ |
Hansen, Tony (th1395) | 4b6b346 | 2022-08-17 21:36:24 +0000 | [diff] [blame] | 47 | self.assertTrue(hasattr(tds, 'c_config')) |
Vijay VK | 339ca1c | 2018-03-27 02:05:36 +0100 | [diff] [blame] | 48 | |
Hansen, Tony (th1395) | cf7f98a | 2021-12-02 20:42:43 +0000 | [diff] [blame] | 49 | |
Vijay VK | 339ca1c | 2018-03-27 02:05:36 +0100 | [diff] [blame] | 50 | def test_dns_cache_ip_to_name(self): |
| 51 | """ |
Hansen, Tony (th1395) | cf7f98a | 2021-12-02 20:42:43 +0000 | [diff] [blame] | 52 | Test dns cache name dict |
Vijay VK | 339ca1c | 2018-03-27 02:05:36 +0100 | [diff] [blame] | 53 | """ |
Hansen, Tony (th1395) | 4b6b346 | 2022-08-17 21:36:24 +0000 | [diff] [blame] | 54 | self.assertTrue(hasattr(tds, 'dns_cache_ip_to_name')) |
Vijay VK | 339ca1c | 2018-03-27 02:05:36 +0100 | [diff] [blame] | 55 | |
Vijay VK | 339ca1c | 2018-03-27 02:05:36 +0100 | [diff] [blame] | 56 | |
| 57 | def test_dns_cache_ip_expires(self): |
| 58 | """ |
Hansen, Tony (th1395) | cf7f98a | 2021-12-02 20:42:43 +0000 | [diff] [blame] | 59 | Test dns cache ip expires dict |
Vijay VK | 339ca1c | 2018-03-27 02:05:36 +0100 | [diff] [blame] | 60 | """ |
Hansen, Tony (th1395) | 4b6b346 | 2022-08-17 21:36:24 +0000 | [diff] [blame] | 61 | self.assertTrue(hasattr(tds, 'dns_cache_ip_expires')) |
Vijay VK | 339ca1c | 2018-03-27 02:05:36 +0100 | [diff] [blame] | 62 | |
Hansen, Tony (th1395) | cf7f98a | 2021-12-02 20:42:43 +0000 | [diff] [blame] | 63 | |
Hansen, Tony (th1395) | 4b6b346 | 2022-08-17 21:36:24 +0000 | [diff] [blame] | 64 | if __name__ == "__main__": # pragma: no cover |
Vijay VK | 339ca1c | 2018-03-27 02:05:36 +0100 | [diff] [blame] | 65 | unittest.main() |