def test_run(self, migrate_tasks): out = WhateverIO() m = migrate(app=self.app, stdout=out, stderr=WhateverIO()) with self.assertRaises(TypeError): m.run() self.assertFalse(migrate_tasks.called) m.run("memory://foo", "memory://bar") self.assertTrue(migrate_tasks.called) state = Mock() state.count = 10 state.strtotal = 30 m.on_migrate_task(state, {"task": "tasks.add", "id": "ID"}, None) self.assertIn("10/30", out.getvalue())
def test_run(self, migrate_tasks): out = WhateverIO() m = migrate(app=self.app, stdout=out, stderr=WhateverIO()) with self.assertRaises(TypeError): m.run() migrate_tasks.assert_not_called() m.run('memory://foo', 'memory://bar') migrate_tasks.assert_called() state = Mock() state.count = 10 state.strtotal = 30 m.on_migrate_task(state, {'task': 'tasks.add', 'id': 'ID'}, None) self.assertIn('10/30', out.getvalue())
def test_run(self, migrate_tasks): out = WhateverIO() m = migrate(app=self.app, stdout=out, stderr=WhateverIO()) with self.assertRaises(SystemExit): m.run() self.assertFalse(migrate_tasks.called) m.run("memory://foo", "memory://bar") self.assertTrue(migrate_tasks.called) state = Mock() state.count = 10 state.strtotal = 30 m.on_migrate_task(state, {"task": "tasks.add", "id": "ID"}, None) self.assertIn("10/30", out.getvalue())