test_print.py 829 B

123456789101112131415161718192021222324252627
  1. import pytest
  2. from twhatter.output import Print
  3. @pytest.fixture
  4. def timeline_attribute():
  5. return "twhatter.exploration.node.timeline.ClientTimeline"
  6. @pytest.fixture
  7. def profile_attribute():
  8. return "twhatter.exploration.node.profile.ClientProfile"
  9. @pytest.fixture
  10. def output():
  11. return Print()
  12. @pytest.mark.parametrize("fixtures_file, expected_len", [
  13. ('tests/fixtures/tweets/text_only_10.yaml', 10),
  14. ('tests/fixtures/tweets/retweet_10.yaml', 10),
  15. ('tests/fixtures/tweets/link_10.yaml', 10),
  16. ('tests/fixtures/tweets/reaction_9.yaml', 9),
  17. ])
  18. def test_output_tweets(capsys, tweets_factory, output, fixtures_file, expected_len):
  19. tweets = tweets_factory(fixtures_file)
  20. output.output_tweets(tweets)
  21. captured = capsys.readouterr()
  22. assert len(captured.out.split('\n')) == expected_len + 1