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.

45 lines
1.5 KiB

  1. import unittest
  2. import sys
  3. import datetime
  4. from scripts import utils
  5. from scripts import lookup
  6. from test_required import required
  7. class LookupBuildingIntegrationTestCase(unittest.TestCase):
  8. def test_lab_lookups(self):
  9. parser, (options, arguments), rooms, info = required()
  10. (options, args) = parser.parse_args(["-L"])
  11. lst = utils.get_lst(rooms[0], rooms[1], options)
  12. week, day, hour = '9', '5', '1600'
  13. look = lookup.LookUp(week, day, hour)
  14. utils.check_args(week, day)
  15. look.check_time(info[0])
  16. def test_room_lookups(self):
  17. parser, (options, arguments), rooms, info = required()
  18. (options, args) = parser.parse_args(["-C"])
  19. lst = utils.get_lst(rooms[0], rooms[1], options)
  20. week, day, hour = '9', '2', '0930'
  21. look = lookup.LookUp(week, day, hour)
  22. utils.check_args(week, day)
  23. look.check_time(info[0])
  24. def test_incorrect_lookups(self):
  25. parser, (options, arguments), rooms, info = required()
  26. try:
  27. assert not isinstance(rooms, basestring) and not isinstance(info, basestring)
  28. except TypeError:
  29. print("Type error has occured")
  30. sys.exit(1)
  31. (options, args) = parser.parse_args(["-L"])
  32. lst = utils.get_lst(rooms[0], rooms[1], options)
  33. week, day, hour = '53', '7', '1600'
  34. look = lookup.LookUp(week, day, hour)
  35. try:
  36. utils.check_args(week, day)
  37. except SystemExit:
  38. pass
  39. if __name__ == '__main__':
  40. unittest.main()