A mirror of dcurooms found at https://github.com/theycallmemac/dcurooms
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
942 B

  1. import unittest
  2. import sys
  3. import datetime
  4. import os
  5. sys.path.append('.')
  6. class AvailableNowTestCase(unittest.TestCase):
  7. def setUp(self):
  8. available_result = os.system(
  9. """python scripts/dcurooms -anC > tests/available_output.txt""")
  10. self.assertTrue(available_result == 0)
  11. def test_available_output(self):
  12. if self.setUp():
  13. with open('available_output.txt') as f:
  14. for line in f:
  15. if len(line.strip()[14:]) > 0:
  16. self.assertEqual("""Outside scheduled timetables.
  17. Try again at 08:00.""", line.strip())
  18. else:
  19. self.assertEqual("", line.strip()[14:])
  20. self.tearDown()
  21. def tearDown(self):
  22. del_result = os.system("""rm tests/*.txt""")
  23. self.assertTrue(del_result == 0)
  24. if __name__ == '__main__':
  25. unittest.main()