marcosschroh / pyinstamation

Easy to use, config oriented, instagram bot, written in python 3
GNU General Public License v3.0
11 stars 2 forks source link

Some bot tests. Bugs fixed: _should_comment and _should_follow #11

Closed marcosschroh closed 7 years ago

marcosschroh commented 7 years ago

PD: You can add

if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(BotTestCase)
    unittest.TextTestRunner(verbosity=2).run(suite)

to each test file. It's useful to run them individually to save time.

I have to finish the remainder bot tests.

codecov-io commented 7 years ago

Codecov Report

Merging #11 into master will increase coverage by 11.76%. The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master      #11       +/-   ##
===========================================
+ Coverage   62.45%   74.22%   +11.76%     
===========================================
  Files          19       20        +1     
  Lines         927      997       +70     
===========================================
+ Hits          579      740      +161     
+ Misses        348      257       -91
Impacted Files Coverage Δ
pyinstamation/bot.py 55.87% <100%> (+36.84%) :arrow_up:
tests/test_bot.py 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b6b36b1...0917d60. Read the comment docs.

woile commented 7 years ago

Adding

if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(BotTestCase)
    unittest.TextTestRunner(verbosity=2).run(suite)

Reduces the overall coverage. And you can run individual tests by doing:

python -m unittests tests/test_bot.py

Or a single test by doing:

python -m unittests tests.test_bot.BotTestCase.test_upload_multiple_pictures

woile commented 7 years ago

Excellent!!! We could add some failing test cases. Like for example what happens if login is not possible? how does the bot (should) react?