test_print.py 621 B

1234567891011121314151617181920
  1. import pytest
  2. from twhatter.output import Print
  3. @pytest.fixture
  4. def output():
  5. return Print()
  6. @pytest.mark.parametrize("fixtures_file, expected_len", [
  7. ('tests/fixtures/tweets/text_only_10.yaml', 10),
  8. ('tests/fixtures/tweets/retweet_10.yaml', 10),
  9. ('tests/fixtures/tweets/link_10.yaml', 10),
  10. ('tests/fixtures/tweets/reaction_9.yaml', 9),
  11. ])
  12. def test_output_tweets(capsys, tweets_factory, output, fixtures_file, expected_len):
  13. tweets = tweets_factory(fixtures_file)
  14. output.output_tweets(tweets)
  15. captured = capsys.readouterr()
  16. assert len(captured.out.split('\n')) == expected_len + 1