diff options
author | Pavel Moravec <pmoravec@redhat.com> | 2023-02-14 22:57:31 +0100 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2023-02-15 16:40:29 -0500 |
commit | f46b5812cd455c2361910fcf1eaddf7707b66068 (patch) | |
tree | 3725f7a2862c5ae707c267a4e0e4505a95f86086 /tests | |
parent | 11763c36ced8dd07d7586d59255e8d74754efe4d (diff) | |
download | sos-f46b5812cd455c2361910fcf1eaddf7707b66068.tar.gz |
[tests] Add test for AD username obfuscation
Add unit test for #3030.
Relevant: #3030
Resolves: #3135
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unittests/cleaner_tests.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/unittests/cleaner_tests.py b/tests/unittests/cleaner_tests.py index 8cf34341..c28239a7 100644 --- a/tests/unittests/cleaner_tests.py +++ b/tests/unittests/cleaner_tests.py @@ -14,6 +14,7 @@ from sos.cleaner.parsers.mac_parser import SoSMacParser from sos.cleaner.parsers.hostname_parser import SoSHostnameParser from sos.cleaner.parsers.keyword_parser import SoSKeywordParser from sos.cleaner.parsers.ipv6_parser import SoSIPv6Parser +from sos.cleaner.parsers.username_parser import SoSUsernameParser from sos.cleaner.mappings.ip_map import SoSIPMap from sos.cleaner.mappings.mac_map import SoSMacMap from sos.cleaner.mappings.hostname_map import SoSHostnameMap @@ -156,6 +157,8 @@ class CleanerParserTests(unittest.TestCase): self.kw_parser = SoSKeywordParser(config={}, keywords=['foobar']) self.kw_parser_none = SoSKeywordParser(config={}) self.kw_parser.generate_item_regexes() + self.uname_parser = SoSUsernameParser(config={}, + opt_names=['DOMAIN\myusername']) def test_ip_parser_valid_ipv4_line(self): line = 'foobar foo 10.0.0.1/24 barfoo bar' @@ -266,3 +269,8 @@ class CleanerParserTests(unittest.TestCase): logln = 'Automatically imported trusted_ca::ca from trusted_ca/ca into production' log_test = self.ipv6_parser.parse_line(logln)[0] self.assertEqual(logln, log_test, "IPv6 parser incorrectly matched a log line of 'trusted_ca::ca'") + + def test_ad_username(self): + line = "DOMAIN\myusername" + _test = self.uname_parser.parse_line(line)[0] + self.assertNotEqual(line, _test) |