def test_table_json(self, mock_execute):
     mock_execute.side_effect = self._mock_manager
     rst = RouteSummaryTable(self.dev)
     rst.get()
     resp = rst.to_json()
     j = '{"ISP-1.inet.0": {"proto": {"Local": {"count": 1, "active": 1}, ' \
         '"Direct": {"count": 3, "active": 3}}, "dests": 4, "holddown": 0, "active": 4, "hidden": 0, "total": 4}, ' \
         '"ISP-2.inet.0": {"proto": {"Local": {"count": 1, "active": 1}, "Direct": {"count": 3, "active": 3}}, ' \
         '"dests": 4, "holddown": 0, "active": 4, "hidden": 0, "total": 4}, "inet.0": {"proto": {"Static": {"count": 1, "active": 1}, ' \
         '"Local": {"count": 4, "active": 4}, "Direct": {"count": 4, "active": 3}}, "dests": 8, "holddown": 0, "active": 8, "hidden": 0, "total": 9}}'
     self.assertEqual(resp, j)
 def test_table_json(self, mock_execute):
     mock_execute.side_effect = self._mock_manager
     rst = RouteSummaryTable(self.dev)
     rst.get()
     resp = rst.to_json()
     j = '{"ISP-1.inet.0": {"proto": {"Local": {"count": 1, "active": 1}, ' \
         '"Direct": {"count": 3, "active": 3}}, "dests": 4, "holddown": 0, "active": 4, "hidden": 0, "total": 4}, ' \
         '"ISP-2.inet.0": {"proto": {"Local": {"count": 1, "active": 1}, "Direct": {"count": 3, "active": 3}}, ' \
         '"dests": 4, "holddown": 0, "active": 4, "hidden": 0, "total": 4}, "inet.0": {"proto": {"Static": {"count": 1, "active": 1}, ' \
         '"Local": {"count": 4, "active": 4}, "Direct": {"count": 4, "active": 3}}, "dests": 8, "holddown": 0, "active": 8, "hidden": 0, "total": 9}}'
     self.assertEqual(resp, j)
示例#3
0
 def test_table_json(self, mock_execute):
     mock_execute.side_effect = self._mock_manager
     rst = RouteSummaryTable(self.dev)
     rst.get()
     resp = rst.to_json()
     j = {'ISP-1.inet.0': {'proto': {'Local': {'count': 1, 'active': 1}, 'Direct': {'count': 3, 'active': 3}},
                           'dests': 4, 'holddown': 0, 'active': 4, 'hidden': 0, 'total': 4},
          'ISP-2.inet.0': {'proto': {'Local': {'count': 1, 'active': 1}, 'Direct': {'count': 3, 'active': 3}},
                           'dests': 4, 'holddown': 0, 'active': 4, 'hidden': 0, 'total': 4},
          'inet.0': {'proto': {'Local': {'count': 4, 'active': 4}, 'Static': {'count': 1, 'active': 1},
                               'Direct': {'count': 4, 'active': 3}}, 'dests': 8, 'holddown': 0, 'active': 8,
                     'hidden': 0, 'total': 9}}
     self.assertEqual(eval(resp), j)