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.

28 regels
824 B

  1. import unittest
  2. import sys
  3. import datetime
  4. import os
  5. sys.path.append('../')
  6. from scripts.dcurooms import build_timetable, get_current_time, check_room, main
  7. class FreeNowTestCase(unittest.TestCase):
  8. def test_options(self):
  9. free_result = os.system("cd ../scripts/ && python dcurooms.py -fnc > ../tests/output.txt")
  10. return self.assertTrue(free_result == 0)
  11. def test_output(self):
  12. if self.test_options():
  13. with open('output.txt') as f:
  14. for line in f:
  15. if len(line.strip()[14:]) > 0:
  16. return self.assertEqual("Outside scheduled timetables. Try again at 08:00.", line.strip())
  17. else:
  18. return self.assertEqual("", line.strip()[14:])
  19. if __name__ == '__main__':
  20. unittest.main()