test_report.py 926 B

1234567891011121314151617181920212223242526272829
  1. # -*- coding: utf-8 -*-
  2. """Tests for ``celery report`` command."""
  3. from __future__ import absolute_import, unicode_literals
  4. from case import Mock, call, patch
  5. from celery.bin.celery import report
  6. from celery.five import WhateverIO
  7. class test_report:
  8. """Test report command class."""
  9. def test_run(self):
  10. out = WhateverIO()
  11. with patch(
  12. 'celery.loaders.base.BaseLoader.import_default_modules'
  13. ) as import_default_modules:
  14. with patch(
  15. 'celery.app.base.Celery.bugreport'
  16. ) as bugreport:
  17. # Method call order mock obj
  18. mco = Mock()
  19. mco.attach_mock(import_default_modules, 'idm')
  20. mco.attach_mock(bugreport, 'br')
  21. a = report(app=self.app, stdout=out)
  22. a.run()
  23. calls = [call.idm(), call.br()]
  24. mco.assert_has_calls(calls)