class HpTest(unittest2.TestCase): def setUp(self): self.host = '10.145.88.140' self.credential = {'Version': 'v2c', 'Community': 'public'} self.hpSwitch = Hp() def tearDown(self): del self.hpSwitch @patch('compass.hdsdiscovery.utils.snmp_get') def test_IsThisVendor(self, snmpget_mock): snmpget_mock.return_value = "ProCurve J9089A Switch 2610-48-PWR" self.assertTrue(self.hpSwitch.is_this_vendor(self.host, self.credential)) snmpget_mock.return_value = None self.assertFalse(self.hpSwitch.is_this_vendor(self.host, self.credential)) snmpget_mock.return_value = "xxxxxxxxxxx" self.assertFalse(self.hpSwitch.is_this_vendor(self.host, self.credential))
def setUp(self): self.host = '10.145.88.140' self.credential = {'Version': 'v2c', 'Community': 'public'} self.hpSwitch = Hp()