def test_complete_output(self): self.maxDiff = None lisp = Lisp(device=self.device) # Return outputs above as inputs to parser when called self.device.execute = Mock() self.device.execute.side_effect = mapper # Learn the feature lisp.learn() # Verify Ops was created successfully self.assertEqual(lisp.info, LispOutput.LispInfo)
def test_empty_output(self): self.maxDiff = None lisp = Lisp(device=self.device) # Return outputs above as inputs to parser when called self.device.execute = Mock() self.device.execute.side_effect = empty_mapper # Learn the feature lisp.learn() # Verify attribute is missing with self.assertRaises(AttributeError): lisp.info['lisp_router_instances']
def test_selective_attribute(self): self.maxDiff = None lisp = Lisp(device=self.device) # Return outputs above as inputs to parser when called self.device.execute = Mock() self.device.execute.side_effect = mapper # Learn the feature lisp.learn() # Check selective attribute self.assertEqual('13.13.13.13', lisp.info['lisp_router_instances'][0]\ ['service']['ipv4']['etr']\ ['mapping_servers']['13.13.13.13']\ ['ms_address'])
def test_missing_attributes(self): self.maxDiff = None lisp = Lisp(device=self.device) # Return outputs above as inputs to parser when called self.device.execute = Mock() self.device.execute.side_effect = incomplete_mapper # Learn the feature lisp.learn() # Verify key not created due to ouput missing with self.assertRaises(KeyError): ms_address = lisp.info['lisp_router_instances'][0]\ ['service']['ipv4']['etr']\ ['mapping_servers']['13.13.13.13']\ ['ms_address']