CAT-SOOP is a flexible, programmable learning management system based on the Python programming language. https://catsoop.mit.edu
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.
 
 
 

60 lines
1.8 KiB

  1. # This file is part of CAT-SOOP
  2. # Copyright (c) 2011-2020 by The CAT-SOOP Developers <catsoop-dev@mit.edu>
  3. #
  4. # This program is free software: you can redistribute it and/or modify it under
  5. # the terms of the GNU Affero General Public License as published by the Free
  6. # Software Foundation, either version 3 of the License, or (at your option) any
  7. # later version.
  8. #
  9. # This program is distributed in the hope that it will be useful, but WITHOUT
  10. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  11. # FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
  12. # details.
  13. #
  14. # You should have received a copy of the GNU Affero General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. """
  17. Unit tests for CAT-SOOP
  18. Requires config to be setup, including cs_unit_test_course
  19. """
  20. import unittest
  21. from catsoop import loader
  22. from catsoop import dispatch
  23. from ..test import CATSOOPTest
  24. # -----------------------------------------------------------------------------
  25. class Test_Basic(CATSOOPTest):
  26. """
  27. some basic tests for CAT-SOOP
  28. """
  29. def setUp(self):
  30. CATSOOPTest.setUp(self)
  31. context = {}
  32. loader.load_global_data(context)
  33. assert "cs_unit_test_course" in context
  34. self.cname = context["cs_unit_test_course"]
  35. def test_static1(self):
  36. env = {"PATH_INFO": "/%s/structure" % self.cname}
  37. status, retinfo, msg = dispatch.main(env)
  38. msg = msg.decode("utf8")
  39. assert status[0] == "200"
  40. assert "6.SAMP" in msg
  41. def test_context1(self):
  42. env = {"PATH_INFO": "/%s/structure" % self.cname}
  43. context = dispatch.main(env, return_context=True)
  44. cui = context["cs_user_info"]
  45. assert cui["role"] == "Guest"
  46. if __name__ == "__main__":
  47. unittest.main()