Support SVR prefix in hostname cleanup
All checks were successful
Build and Release / Build Windows Exe (push) Successful in 11s

This commit is contained in:
2026-02-06 16:06:30 -05:00
parent 07c7ec23d9
commit 5c95469ca3
2 changed files with 17 additions and 2 deletions

View File

@@ -27,5 +27,20 @@ class TestInventoryKeys(unittest.TestCase):
self.assertEqual(host_vars['ansible_host'], "192.168.1.10")
self.assertEqual(host_vars['ansible_connection'], "winrm")
def test_clean_reference_logic(self):
from wif2ansible.parsers import clean_reference
# Test cases
self.assertEqual(clean_reference("SRV123 MyServer"), "MyServer")
self.assertEqual(clean_reference("SVR999 AnotherServer"), "AnotherServer")
self.assertEqual(clean_reference("srv001 lowercase"), "lowercase")
self.assertEqual(clean_reference("SvR555 MixedCase"), "MixedCase")
self.assertEqual(clean_reference("JustName"), "JustName")
self.assertEqual(clean_reference("SRV123"), "") # Should be empty? or handle?
# If it's just SRV123, strip returns empty.
# User said "never include these in output".
# If the server is ONLY named SRV123, what then?
# Assuming there is usually a name.
if __name__ == '__main__':
unittest.main()