#!/usr/bin/env python # # Copyright (C) 2011 Instructure, Inc. # # This file is part of StraitJacket. # # StraitJacket is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation, version 3 of the License. # # StraitJacket is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License along # with this program. If not, see <http://www.gnu.org/licenses/>. # import os, sys sys.path.append(os.path.realpath(os.path.dirname(__file__))) from server import webapp application = webapp(skip_language_checks=True).wsgifunc()
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License along # with this program. If not, see <http://www.gnu.org/licenses/>. # import server, unittest, urllib, json, re __author__ = "JT Olds" __copyright__ = "Copyright 2011 Instructure, Inc." __license__ = "AGPLv3" __email__ = "*****@*****.**" wrapper = server.straitjacket.StraitJacket(server.DEFAULT_CONFIG_DIR) webapp = server.webapp(wrapper) class TestCase(unittest.TestCase): pass class WebServerTests(TestCase): def execute(self, data, expected_stdout, expected_stderr, expected_exitstatus, expected_error): response = webapp.request("/execute", "POST", urllib.urlencode(data)) self.assertEquals(response.status, "200 OK") r = json.loads(response.data) try: if type(expected_stdout) in (str, unicode): if r["stdout"] != expected_stdout: raise Exception else:
#!/usr/bin/env python # # Copyright (C) 2011 Instructure, Inc. # # This file is part of CodeWarden. # # CodeWarden is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation, version 3 of the License. # # CodeWarden is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License along # with this program. If not, see <http://www.gnu.org/licenses/>. # import os, sys sys.path.append(os.path.realpath(os.path.dirname(__file__))) from server import webapp application = webapp().wsgifunc()
#!/usr/bin/env python # # Copyright (C) 2011 Instructure, Inc. # # This file is part of CodeWarden. # # CodeWarden is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation, version 3 of the License. # # CodeWarden is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License along # with this program. If not, see <http://www.gnu.org/licenses/>. # import os, sys root_dir = os.path.realpath(os.path.dirname(__file__)) os.chdir(root_dir) sys.path.append(root_dir) from server import webapp application = webapp(skip_language_checks=True).wsgifunc()
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License along # with this program. If not, see <http://www.gnu.org/licenses/>. # import server, unittest, urllib, json, re __author__ = "JT Olds" __copyright__ = "Copyright 2011 Instructure, Inc." __license__ = "AGPLv3" __email__ = "*****@*****.**" wrapper = server.straitjacket.StraitJacket(server.DEFAULT_CONFIG_DIR) webapp = server.webapp(wrapper) class TestCase(unittest.TestCase): pass class WebServerTests(TestCase): def execute(self, data, expected_stdout, expected_stderr, expected_exitstatus, expected_error): response = webapp.request("/execute", "POST", urllib.urlencode(data)) self.assertEquals(response.status, "200 OK") r = json.loads(response.data) try: if type(expected_stdout) in (str, unicode): if r["stdout"] != expected_stdout: raise Exception