def test_format_lscss_use_pim_notequal_pam(self): """ unit test to validate _format_lscss() with pim mask not equal to pam mask """ device = { "Device": "0.0.0200", "Subchan": "0.0.0000", "DevType": "3390/0a", "CU Type": "3390/0a", "Use": " ", "PIM": "80", "PAM": "e0", "POM": "ff", "CHPIDs": "b0b10d00 00000000" } output = { "device": "0.0.0200", "sub_channel": "0.0.0000", "device_type": "3390/0a", "cu_type": "3390/0a", "status": "offline", "enabled_chipids": ["b0", "b1", "0d"], "installed_chipids": ["b0"] } formated_devices = utils._format_lscss(device) self.assertEqual(formated_devices, output)
def test_format_lscss_emptyjsoninput(self): """ unit test to validate _format_lscss() with empty json i/p _format_lscss() should return empty json """ device = {} formated_devices = utils._format_lscss(device) self.assertEqual(formated_devices, device)
def test_format_lscss_Noneinput(self): """ unit test to validate _format_lscss() with None input _format_lscss() should return None """ device = None formated_devices = utils._format_lscss(device) self.assertEqual(formated_devices, None)
def test_format_lscss_use_yes(self): """ unit test to validate _format_lscss() with "Use" as "yes" """ device = {"Device": "0.0.0200", "Subchan": "0.0.0000", "DevType": "3390/0a", "CU Type": "3390/0a", "Use": "yes", "PIM": "e0", "PAM": "e0", "POM": "ff", "CHPIDs": "b0b10d00 00000000"} output = {"device": "0.0.0200", "sub_channel": "0.0.0000", "device_type": "3390/0a", "cu_type": "3390/0a", "status": "online", "enabled_chipids": ["b0", "b1", "0d"], "installed_chipids": ["b0", "b1", "0d"]} formated_devices = utils._format_lscss(device) self.assertEqual(formated_devices, output)