test_twhatter.py 999 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/usr/bin/env python
  2. # coding: utf-8
  3. """Tests for `twhatter` package."""
  4. import pytest
  5. from click.testing import CliRunner
  6. from twhatter import twhatter
  7. from twhatter import cli
  8. @pytest.fixture
  9. def response():
  10. """Sample pytest fixture.
  11. See more at: http://doc.pytest.org/en/latest/fixture.html
  12. """
  13. # import requests
  14. # return requests.get('https://github.com/audreyr/cookiecutter-pypackage')
  15. def test_content(response):
  16. """Sample pytest test function with the pytest fixture as an argument."""
  17. # from bs4 import BeautifulSoup
  18. # assert 'GitHub' in BeautifulSoup(response.content).title.string
  19. def test_command_line_interface():
  20. """Test the CLI."""
  21. runner = CliRunner()
  22. result = runner.invoke(cli.main)
  23. assert result.exit_code == 0
  24. assert 'twhatter.cli.main' in result.output
  25. help_result = runner.invoke(cli.main, ['--help'])
  26. assert help_result.exit_code == 0
  27. assert '--help Show this message and exit.' in help_result.output