Пример #1
0
 def test_reset(self, mock_remove_services, mock_remove_chains):
     from eskapade import ProcessManager
     pm = ProcessManager()
     pm.custom_attribute = 'test'
     pm.reset()
     mock_remove_services.assert_called()
     mock_remove_chains.assert_called()
     self.assertFalse(hasattr(pm, 'custom_attribute'),
                      'custom_attribute was not removed')
Пример #2
0
 def test_singleton(self):
     pm1 = ProcessManager()
     pm1.custom_attribute = 'test_attr'
     pm2 = ProcessManager()
     self.assertIs(pm1, pm2, 'process manager is not a singleton')
     self.assertTrue(
         hasattr(pm2, 'custom_attribute'),
         'process-manager attributes are reset upon re-creation')
     self.assertEqual(
         pm2.custom_attribute, 'test_attr',
         'process-manager attributes are changed upon re-creation')