test_list.py 711 B

12345678910111213141516171819202122232425262728
  1. from __future__ import absolute_import, unicode_literals
  2. import pytest
  3. from case import Mock
  4. from kombu.five import WhateverIO
  5. from celery.bin.base import Error
  6. from celery.bin.list import list_
  7. class test_list:
  8. def test_list_bindings_no_support(self):
  9. l = list_(app=self.app, stderr=WhateverIO())
  10. management = Mock()
  11. management.get_bindings.side_effect = NotImplementedError()
  12. with pytest.raises(Error):
  13. l.list_bindings(management)
  14. def test_run(self):
  15. l = list_(app=self.app, stderr=WhateverIO())
  16. l.run('bindings')
  17. with pytest.raises(Error):
  18. l.run(None)
  19. with pytest.raises(Error):
  20. l.run('foo')