def test_is_alive_exception(self): self.mock_get.side_effect = Exception self.assertFalse(astara_client.is_alive('fe80::2', 5000)) self.mock_get.assert_called_once_with( 'http://[fe80::2]:5000/v1/firewall/rules', timeout=3.0 )
def test_is_alive_bad_status(self): self.mock_get.return_value.status_code = 500 self.assertFalse(astara_client.is_alive('fe80::2', 5000)) self.mock_get.assert_called_once_with( 'http://[fe80::2]:5000/v1/firewall/rules', timeout=3.0 )
def is_alive(self, management_address): """Determines whether the managed resource is alive :returns: bool True if alive, False if not """ return astara_client.is_alive(management_address, self.mgt_port)